import requests
from zipfile import ZipFile
from io import BytesIO
import pandas as pd
import numpy as np
from google.colab import files
Need to upload the Zip Code or Contaminant (or UCMR3_5_Combo_with_ZIPCODES) csv file you want to use everytime this is run.
# files.upload()
from google.colab import drive
drive.mount('/content/drive')
Mounted at /content/drive
Make sure this is the Zip Code or Contaminant csv file you want.
#df = pd.read_csv('UCMR_3_5_Combo_with_ZIPCODES.csv') # very large dataset- over 6.6 million rows
df = pd.read_csv('/content/drive/MyDrive/Z Colab Notebooks/small_UCMR_3_5_Combo_with_ZIPCODES.csv')
#df.head(50)
df.head(9999)
| CollectionDate | Contaminant | AnalyticalResultValue | ZIPCODE | Latitude | Longitude | |
|---|---|---|---|---|---|---|
| 0 | 1.426550e+09 | chlorate | 160.0000 | 6339 | 41.44408 | -71.99851 |
| 1 | 1.426550e+09 | strontium | 72.0000 | 6339 | 41.44408 | -71.99851 |
| 2 | 1.434586e+09 | chlorate | 340.0000 | 6339 | 41.44408 | -71.99851 |
| 3 | 1.434586e+09 | strontium | 66.0000 | 6339 | 41.44408 | -71.99851 |
| 4 | 1.444003e+09 | strontium | 62.0000 | 6339 | 41.44408 | -71.99851 |
| ... | ... | ... | ... | ... | ... | ... |
| 370 | 1.727309e+09 | PFHxA | 0.0085 | 35005 | 33.59215 | -86.99833 |
| 371 | 1.727309e+09 | PFBS | 0.0055 | 35005 | 33.59215 | -86.99833 |
| 372 | 1.686787e+09 | PFBS | 0.0033 | 48858 | 43.61483 | -84.79576 |
| 373 | 1.701821e+09 | PFBS | 0.0048 | 48858 | 43.61483 | -84.79576 |
| 374 | 1.686787e+09 | lithium | 9.4300 | 48858 | 43.61483 | -84.79576 |
375 rows × 6 columns
Create heatmaps based on latitude, longitude, AnalyticalResultValue.
import folium
from folium.plugins import HeatMap
import os
def save_heatmap_to_file(m, file_name):
"""Saves a Folium map object as an HTML file.
Args:
m (folium.folium.Map): The Folium map object to save.
file_name (str): The name of the file to save the map to.
"""
m.save(file_name)
# Create an 'output_heatmaps' directory if it doesn't exist
output_dir = 'output_heatmaps_no_blanks'
if not os.path.exists(output_dir):
os.makedirs(output_dir)
For small_UCRM_3_5_Combo_with_ZIPCODES.csv which has six zip codes out of 18,601 zip codes: Create one heatmap of all contaminants based on latitude, longitude, AnalyticalResultValue. Can be used for all 82 heatmaps if using the large csv file UCMR_3_5_Combo_with_ZIPCODES.csv
# This is too much data for all 82 contaminants, keeps crashing. Can do smaller zip codes data instead.
print(f"Generating heatmap for all contaminants based on location and AnalyticalResultValue.\n")
# Prepare data for this heatmap using vectorized operations
heatmap_data = df[['Latitude', 'Longitude', 'AnalyticalResultValue']].values.tolist()
#Create a folium map centered on the US
m = folium.Map(location=[37.8, -96.9], zoom_start=4)
# Add a heatmap layer using Latitude, Longitude, and concentration (MRL)
HeatMap(heatmap_data, min_opacity=0.2, radius=10, blur=10, max_zoom=1).add_to(m)
display(m)
print("\n")
# Create file name and save the map
# file_name = os.path.join(output_dir, f"all_heatmap.html")
# save_heatmap_to_file(m, file_name)
Generating heatmap for all contaminants based on location and AnalyticalResultValue.
For UCMR_3_5_Combo_with_ZIPCODES.csv: Create 85 heatmaps for each contaminant based on latitude, longitude, MRLs. Otherwise will create heatmaps with any other csv we are using.
i = 0
for contaminant, group_data in sorted(df.groupby('Contaminant')):
print(f"Generating heatmap for Contaminant: {contaminant}\n")
# Prepare data for this heatmap
heatmap_data = group_data[['Latitude', 'Longitude', 'AnalyticalResultValue']].values
# Create a folium map centered on the US
m = folium.Map(location=[37.8, -96.9], zoom_start=4)
# Add a heatmap layer using Latitude, Longitude, and concentration (MRL)
HeatMap(heatmap_data, min_opacity=0.2, radius=10, blur=10, max_zoom=1).add_to(m)
display(m)
print("\n")
# Create file name and save the map
file_name = os.path.join(output_dir, f"{contaminant}_heatmap.html")
save_heatmap_to_file(m, file_name)
i += 1
print(f"Heatmaps saved to the '{output_dir}' directory.")
Generating heatmap for Contaminant: 1,4-dioxane
Generating heatmap for Contaminant: 2-methoxyethanol
Generating heatmap for Contaminant: 6:2 FTS
Generating heatmap for Contaminant: HAA5
Generating heatmap for Contaminant: HAA6Br
Generating heatmap for Contaminant: HAA9
Generating heatmap for Contaminant: PFBS
Generating heatmap for Contaminant: PFHxA
Generating heatmap for Contaminant: PFOA
Generating heatmap for Contaminant: PFPeA
Generating heatmap for Contaminant: chlorate
Generating heatmap for Contaminant: chromium
Generating heatmap for Contaminant: chromium-6
Generating heatmap for Contaminant: cobalt
Generating heatmap for Contaminant: lithium
Generating heatmap for Contaminant: manganese
Generating heatmap for Contaminant: molybdenum
Generating heatmap for Contaminant: strontium
Generating heatmap for Contaminant: vanadium
Heatmaps saved to the 'output_heatmaps_no_blanks' directory.
Uncomment this section if wanting to save heatmaps in a zip file.
# import shutil
# shutil.make_archive('output_heatmaps', 'zip', 'output_heatmaps')
# from google.colab import files
# files.download('output_heatmaps.zip')
Linear Regression training and prediction This crashes with all of the zip codes. Just use a few zip codes at a time.
zipcode_data = sorted(df.groupby('ZIPCODE'))
def optimize_zipcode_data_for_time_series_optimized(df):
"""
Optimizes zip code data for time series analysis,
grouping collection dates for a specific contaminant's AnalyticalResultValue.
Args:
df (pd.DataFrame): The input DataFrame.
Returns:
dict: A nested dictionary containing time series data.
{zipcode: {contaminant: {analyticalResultValue: [collection_date, ...]}}}
"""
df = df.sort_values(by=['ZIPCODE', 'CollectionDate'])
zipcode_dict = {}
for _, row in df.iterrows():
zipcode = row['ZIPCODE']
contaminant = row['Contaminant']
collection_date = row['CollectionDate']
analyticalResultValue = row['AnalyticalResultValue']
print(row)
zipcode_dict.setdefault(zipcode, {}).setdefault(contaminant, {}).setdefault(analyticalResultValue, []).append(collection_date)
return zipcode_dict
# Example usage:
zipcode_dict = optimize_zipcode_data_for_time_series_optimized(df)
CollectionDate 1426550400.0 Contaminant chlorate AnalyticalResultValue 160.0 ZIPCODE 6339 Latitude 41.44408 Longitude -71.99851 Name: 0, dtype: object CollectionDate 1426550400.0 Contaminant strontium AnalyticalResultValue 72.0 ZIPCODE 6339 Latitude 41.44408 Longitude -71.99851 Name: 1, dtype: object CollectionDate 1426550400.0 Contaminant chlorate AnalyticalResultValue 30.0 ZIPCODE 6339 Latitude 41.44408 Longitude -71.99851 Name: 9, dtype: object CollectionDate 1426550400.0 Contaminant vanadium AnalyticalResultValue 0.2 ZIPCODE 6339 Latitude 41.44408 Longitude -71.99851 Name: 10, dtype: object CollectionDate 1426550400.0 Contaminant chromium AnalyticalResultValue 0.2 ZIPCODE 6339 Latitude 41.44408 Longitude -71.99851 Name: 11, dtype: object CollectionDate 1426550400.0 Contaminant cobalt AnalyticalResultValue 1.4 ZIPCODE 6339 Latitude 41.44408 Longitude -71.99851 Name: 12, dtype: object CollectionDate 1426550400.0 Contaminant chromium-6 AnalyticalResultValue 0.17 ZIPCODE 6339 Latitude 41.44408 Longitude -71.99851 Name: 13, dtype: object CollectionDate 1426550400.0 Contaminant strontium AnalyticalResultValue 250.0 ZIPCODE 6339 Latitude 41.44408 Longitude -71.99851 Name: 14, dtype: object CollectionDate 1434585600.0 Contaminant chlorate AnalyticalResultValue 340.0 ZIPCODE 6339 Latitude 41.44408 Longitude -71.99851 Name: 2, dtype: object CollectionDate 1434585600.0 Contaminant strontium AnalyticalResultValue 66.0 ZIPCODE 6339 Latitude 41.44408 Longitude -71.99851 Name: 3, dtype: object CollectionDate 1434585600.0 Contaminant cobalt AnalyticalResultValue 1.5 ZIPCODE 6339 Latitude 41.44408 Longitude -71.99851 Name: 15, dtype: object CollectionDate 1434585600.0 Contaminant chromium-6 AnalyticalResultValue 0.14 ZIPCODE 6339 Latitude 41.44408 Longitude -71.99851 Name: 16, dtype: object CollectionDate 1434585600.0 Contaminant vanadium AnalyticalResultValue 0.2 ZIPCODE 6339 Latitude 41.44408 Longitude -71.99851 Name: 17, dtype: object CollectionDate 1434585600.0 Contaminant chlorate AnalyticalResultValue 110.0 ZIPCODE 6339 Latitude 41.44408 Longitude -71.99851 Name: 18, dtype: object CollectionDate 1434585600.0 Contaminant strontium AnalyticalResultValue 270.0 ZIPCODE 6339 Latitude 41.44408 Longitude -71.99851 Name: 19, dtype: object CollectionDate 1444003200.0 Contaminant strontium AnalyticalResultValue 62.0 ZIPCODE 6339 Latitude 41.44408 Longitude -71.99851 Name: 4, dtype: object CollectionDate 1444003200.0 Contaminant chromium-6 AnalyticalResultValue 0.04 ZIPCODE 6339 Latitude 41.44408 Longitude -71.99851 Name: 5, dtype: object CollectionDate 1444003200.0 Contaminant chlorate AnalyticalResultValue 470.0 ZIPCODE 6339 Latitude 41.44408 Longitude -71.99851 Name: 6, dtype: object CollectionDate 1444003200.0 Contaminant chlorate AnalyticalResultValue 170.0 ZIPCODE 6339 Latitude 41.44408 Longitude -71.99851 Name: 20, dtype: object CollectionDate 1444003200.0 Contaminant vanadium AnalyticalResultValue 0.2 ZIPCODE 6339 Latitude 41.44408 Longitude -71.99851 Name: 21, dtype: object CollectionDate 1444003200.0 Contaminant chromium-6 AnalyticalResultValue 0.06 ZIPCODE 6339 Latitude 41.44408 Longitude -71.99851 Name: 22, dtype: object CollectionDate 1444003200.0 Contaminant strontium AnalyticalResultValue 260.0 ZIPCODE 6339 Latitude 41.44408 Longitude -71.99851 Name: 23, dtype: object CollectionDate 1444003200.0 Contaminant cobalt AnalyticalResultValue 1.3 ZIPCODE 6339 Latitude 41.44408 Longitude -71.99851 Name: 24, dtype: object CollectionDate 1450137600.0 Contaminant strontium AnalyticalResultValue 66.0 ZIPCODE 6339 Latitude 41.44408 Longitude -71.99851 Name: 7, dtype: object CollectionDate 1450137600.0 Contaminant chlorate AnalyticalResultValue 370.0 ZIPCODE 6339 Latitude 41.44408 Longitude -71.99851 Name: 8, dtype: object CollectionDate 1450137600.0 Contaminant strontium AnalyticalResultValue 270.0 ZIPCODE 6339 Latitude 41.44408 Longitude -71.99851 Name: 25, dtype: object CollectionDate 1450137600.0 Contaminant cobalt AnalyticalResultValue 1.4 ZIPCODE 6339 Latitude 41.44408 Longitude -71.99851 Name: 26, dtype: object CollectionDate 1450137600.0 Contaminant chlorate AnalyticalResultValue 74.0 ZIPCODE 6339 Latitude 41.44408 Longitude -71.99851 Name: 27, dtype: object CollectionDate 1450137600.0 Contaminant chromium-6 AnalyticalResultValue 0.17 ZIPCODE 6339 Latitude 41.44408 Longitude -71.99851 Name: 28, dtype: object CollectionDate 1450137600.0 Contaminant vanadium AnalyticalResultValue 0.2 ZIPCODE 6339 Latitude 41.44408 Longitude -71.99851 Name: 29, dtype: object CollectionDate 1450137600.0 Contaminant chromium AnalyticalResultValue 0.2 ZIPCODE 6339 Latitude 41.44408 Longitude -71.99851 Name: 30, dtype: object CollectionDate 1522627200.0 Contaminant manganese AnalyticalResultValue 4.976 ZIPCODE 6339 Latitude 41.44408 Longitude -71.99851 Name: 235, dtype: object CollectionDate 1522627200.0 Contaminant HAA6Br AnalyticalResultValue 11.408 ZIPCODE 6339 Latitude 41.44408 Longitude -71.99851 Name: 239, dtype: object CollectionDate 1522627200.0 Contaminant HAA9 AnalyticalResultValue 40.535 ZIPCODE 6339 Latitude 41.44408 Longitude -71.99851 Name: 240, dtype: object CollectionDate 1522627200.0 Contaminant HAA5 AnalyticalResultValue 29.643 ZIPCODE 6339 Latitude 41.44408 Longitude -71.99851 Name: 241, dtype: object CollectionDate 1522627200.0 Contaminant HAA6Br AnalyticalResultValue 10.822 ZIPCODE 6339 Latitude 41.44408 Longitude -71.99851 Name: 251, dtype: object CollectionDate 1522627200.0 Contaminant HAA9 AnalyticalResultValue 36.732 ZIPCODE 6339 Latitude 41.44408 Longitude -71.99851 Name: 252, dtype: object CollectionDate 1522627200.0 Contaminant HAA5 AnalyticalResultValue 26.422 ZIPCODE 6339 Latitude 41.44408 Longitude -71.99851 Name: 253, dtype: object CollectionDate 1528070400.0 Contaminant manganese AnalyticalResultValue 18.045 ZIPCODE 6339 Latitude 41.44408 Longitude -71.99851 Name: 236, dtype: object CollectionDate 1528070400.0 Contaminant HAA6Br AnalyticalResultValue 10.543 ZIPCODE 6339 Latitude 41.44408 Longitude -71.99851 Name: 242, dtype: object CollectionDate 1528070400.0 Contaminant HAA9 AnalyticalResultValue 52.079 ZIPCODE 6339 Latitude 41.44408 Longitude -71.99851 Name: 243, dtype: object CollectionDate 1528070400.0 Contaminant HAA5 AnalyticalResultValue 42.602 ZIPCODE 6339 Latitude 41.44408 Longitude -71.99851 Name: 244, dtype: object CollectionDate 1528070400.0 Contaminant HAA6Br AnalyticalResultValue 11.057 ZIPCODE 6339 Latitude 41.44408 Longitude -71.99851 Name: 254, dtype: object CollectionDate 1528070400.0 Contaminant HAA9 AnalyticalResultValue 52.347 ZIPCODE 6339 Latitude 41.44408 Longitude -71.99851 Name: 255, dtype: object CollectionDate 1528070400.0 Contaminant HAA5 AnalyticalResultValue 42.34 ZIPCODE 6339 Latitude 41.44408 Longitude -71.99851 Name: 256, dtype: object CollectionDate 1536019200.0 Contaminant manganese AnalyticalResultValue 27.482 ZIPCODE 6339 Latitude 41.44408 Longitude -71.99851 Name: 237, dtype: object CollectionDate 1536019200.0 Contaminant HAA6Br AnalyticalResultValue 8.943 ZIPCODE 6339 Latitude 41.44408 Longitude -71.99851 Name: 245, dtype: object CollectionDate 1536019200.0 Contaminant HAA9 AnalyticalResultValue 23.006 ZIPCODE 6339 Latitude 41.44408 Longitude -71.99851 Name: 246, dtype: object CollectionDate 1536019200.0 Contaminant HAA5 AnalyticalResultValue 15.501 ZIPCODE 6339 Latitude 41.44408 Longitude -71.99851 Name: 247, dtype: object CollectionDate 1536019200.0 Contaminant HAA6Br AnalyticalResultValue 9.137 ZIPCODE 6339 Latitude 41.44408 Longitude -71.99851 Name: 257, dtype: object CollectionDate 1536019200.0 Contaminant HAA9 AnalyticalResultValue 27.152 ZIPCODE 6339 Latitude 41.44408 Longitude -71.99851 Name: 258, dtype: object CollectionDate 1536019200.0 Contaminant HAA5 AnalyticalResultValue 19.231 ZIPCODE 6339 Latitude 41.44408 Longitude -71.99851 Name: 259, dtype: object CollectionDate 1543881600.0 Contaminant manganese AnalyticalResultValue 8.949 ZIPCODE 6339 Latitude 41.44408 Longitude -71.99851 Name: 238, dtype: object CollectionDate 1543881600.0 Contaminant HAA6Br AnalyticalResultValue 11.502 ZIPCODE 6339 Latitude 41.44408 Longitude -71.99851 Name: 248, dtype: object CollectionDate 1543881600.0 Contaminant HAA9 AnalyticalResultValue 29.425 ZIPCODE 6339 Latitude 41.44408 Longitude -71.99851 Name: 249, dtype: object CollectionDate 1543881600.0 Contaminant HAA5 AnalyticalResultValue 19.545 ZIPCODE 6339 Latitude 41.44408 Longitude -71.99851 Name: 250, dtype: object CollectionDate 1543881600.0 Contaminant HAA6Br AnalyticalResultValue 11.277 ZIPCODE 6339 Latitude 41.44408 Longitude -71.99851 Name: 260, dtype: object CollectionDate 1543881600.0 Contaminant HAA9 AnalyticalResultValue 32.134 ZIPCODE 6339 Latitude 41.44408 Longitude -71.99851 Name: 261, dtype: object CollectionDate 1543881600.0 Contaminant HAA5 AnalyticalResultValue 22.223 ZIPCODE 6339 Latitude 41.44408 Longitude -71.99851 Name: 262, dtype: object CollectionDate 1426032000.0 Contaminant chromium-6 AnalyticalResultValue 0.0565 ZIPCODE 35005 Latitude 33.59215 Longitude -86.99833 Name: 54, dtype: object CollectionDate 1426032000.0 Contaminant 1,4-dioxane AnalyticalResultValue 0.163 ZIPCODE 35005 Latitude 33.59215 Longitude -86.99833 Name: 55, dtype: object CollectionDate 1426032000.0 Contaminant strontium AnalyticalResultValue 34.7 ZIPCODE 35005 Latitude 33.59215 Longitude -86.99833 Name: 56, dtype: object CollectionDate 1426032000.0 Contaminant chlorate AnalyticalResultValue 80.5 ZIPCODE 35005 Latitude 33.59215 Longitude -86.99833 Name: 57, dtype: object CollectionDate 1426032000.0 Contaminant chromium-6 AnalyticalResultValue 0.0654 ZIPCODE 35005 Latitude 33.59215 Longitude -86.99833 Name: 73, dtype: object CollectionDate 1426032000.0 Contaminant strontium AnalyticalResultValue 40.7 ZIPCODE 35005 Latitude 33.59215 Longitude -86.99833 Name: 74, dtype: object CollectionDate 1426032000.0 Contaminant chlorate AnalyticalResultValue 70.0 ZIPCODE 35005 Latitude 33.59215 Longitude -86.99833 Name: 75, dtype: object CollectionDate 1434585600.0 Contaminant molybdenum AnalyticalResultValue 2.7 ZIPCODE 35005 Latitude 33.59215 Longitude -86.99833 Name: 58, dtype: object CollectionDate 1434585600.0 Contaminant chromium-6 AnalyticalResultValue 0.1 ZIPCODE 35005 Latitude 33.59215 Longitude -86.99833 Name: 59, dtype: object CollectionDate 1434585600.0 Contaminant 1,4-dioxane AnalyticalResultValue 0.09 ZIPCODE 35005 Latitude 33.59215 Longitude -86.99833 Name: 60, dtype: object CollectionDate 1434585600.0 Contaminant vanadium AnalyticalResultValue 0.68 ZIPCODE 35005 Latitude 33.59215 Longitude -86.99833 Name: 61, dtype: object CollectionDate 1434585600.0 Contaminant strontium AnalyticalResultValue 61.0 ZIPCODE 35005 Latitude 33.59215 Longitude -86.99833 Name: 62, dtype: object CollectionDate 1434585600.0 Contaminant molybdenum AnalyticalResultValue 2.63 ZIPCODE 35005 Latitude 33.59215 Longitude -86.99833 Name: 76, dtype: object CollectionDate 1434585600.0 Contaminant chromium-6 AnalyticalResultValue 0.0838 ZIPCODE 35005 Latitude 33.59215 Longitude -86.99833 Name: 77, dtype: object CollectionDate 1434585600.0 Contaminant vanadium AnalyticalResultValue 0.664 ZIPCODE 35005 Latitude 33.59215 Longitude -86.99833 Name: 78, dtype: object CollectionDate 1434585600.0 Contaminant strontium AnalyticalResultValue 59.9 ZIPCODE 35005 Latitude 33.59215 Longitude -86.99833 Name: 79, dtype: object CollectionDate 1441843200.0 Contaminant chromium-6 AnalyticalResultValue 0.09 ZIPCODE 35005 Latitude 33.59215 Longitude -86.99833 Name: 63, dtype: object CollectionDate 1441843200.0 Contaminant vanadium AnalyticalResultValue 0.5 ZIPCODE 35005 Latitude 33.59215 Longitude -86.99833 Name: 64, dtype: object CollectionDate 1441843200.0 Contaminant strontium AnalyticalResultValue 43.0 ZIPCODE 35005 Latitude 33.59215 Longitude -86.99833 Name: 65, dtype: object CollectionDate 1441843200.0 Contaminant manganese AnalyticalResultValue 1.1 ZIPCODE 35005 Latitude 33.59215 Longitude -86.99833 Name: 66, dtype: object CollectionDate 1441843200.0 Contaminant chromium-6 AnalyticalResultValue 0.1 ZIPCODE 35005 Latitude 33.59215 Longitude -86.99833 Name: 80, dtype: object CollectionDate 1441843200.0 Contaminant vanadium AnalyticalResultValue 0.5 ZIPCODE 35005 Latitude 33.59215 Longitude -86.99833 Name: 81, dtype: object CollectionDate 1441843200.0 Contaminant strontium AnalyticalResultValue 51.0 ZIPCODE 35005 Latitude 33.59215 Longitude -86.99833 Name: 82, dtype: object CollectionDate 1441843200.0 Contaminant chlorate AnalyticalResultValue 78.0 ZIPCODE 35005 Latitude 33.59215 Longitude -86.99833 Name: 83, dtype: object CollectionDate 1441843200.0 Contaminant manganese AnalyticalResultValue 1.1 ZIPCODE 35005 Latitude 33.59215 Longitude -86.99833 Name: 84, dtype: object CollectionDate 1449619200.0 Contaminant 1,4-dioxane AnalyticalResultValue 0.18635 ZIPCODE 35005 Latitude 33.59215 Longitude -86.99833 Name: 67, dtype: object CollectionDate 1449619200.0 Contaminant chromium-6 AnalyticalResultValue 0.059 ZIPCODE 35005 Latitude 33.59215 Longitude -86.99833 Name: 68, dtype: object CollectionDate 1449619200.0 Contaminant strontium AnalyticalResultValue 49.362 ZIPCODE 35005 Latitude 33.59215 Longitude -86.99833 Name: 69, dtype: object CollectionDate 1449619200.0 Contaminant vanadium AnalyticalResultValue 0.217 ZIPCODE 35005 Latitude 33.59215 Longitude -86.99833 Name: 70, dtype: object CollectionDate 1449619200.0 Contaminant chlorate AnalyticalResultValue 59.187 ZIPCODE 35005 Latitude 33.59215 Longitude -86.99833 Name: 71, dtype: object CollectionDate 1449619200.0 Contaminant manganese AnalyticalResultValue 1.08 ZIPCODE 35005 Latitude 33.59215 Longitude -86.99833 Name: 72, dtype: object CollectionDate 1449619200.0 Contaminant chromium-6 AnalyticalResultValue 0.055 ZIPCODE 35005 Latitude 33.59215 Longitude -86.99833 Name: 85, dtype: object CollectionDate 1449619200.0 Contaminant strontium AnalyticalResultValue 46.111 ZIPCODE 35005 Latitude 33.59215 Longitude -86.99833 Name: 86, dtype: object CollectionDate 1449619200.0 Contaminant vanadium AnalyticalResultValue 0.221 ZIPCODE 35005 Latitude 33.59215 Longitude -86.99833 Name: 87, dtype: object CollectionDate 1449619200.0 Contaminant chlorate AnalyticalResultValue 72.724 ZIPCODE 35005 Latitude 33.59215 Longitude -86.99833 Name: 88, dtype: object CollectionDate 1519084800.0 Contaminant manganese AnalyticalResultValue 1.4 ZIPCODE 35005 Latitude 33.59215 Longitude -86.99833 Name: 177, dtype: object CollectionDate 1519084800.0 Contaminant manganese AnalyticalResultValue 0.402 ZIPCODE 35005 Latitude 33.59215 Longitude -86.99833 Name: 181, dtype: object CollectionDate 1519084800.0 Contaminant manganese AnalyticalResultValue 0.518 ZIPCODE 35005 Latitude 33.59215 Longitude -86.99833 Name: 184, dtype: object CollectionDate 1519084800.0 Contaminant HAA5 AnalyticalResultValue 11.939 ZIPCODE 35005 Latitude 33.59215 Longitude -86.99833 Name: 187, dtype: object CollectionDate 1519084800.0 Contaminant HAA9 AnalyticalResultValue 16.519 ZIPCODE 35005 Latitude 33.59215 Longitude -86.99833 Name: 188, dtype: object CollectionDate 1519084800.0 Contaminant HAA6Br AnalyticalResultValue 5.019 ZIPCODE 35005 Latitude 33.59215 Longitude -86.99833 Name: 189, dtype: object CollectionDate 1519084800.0 Contaminant HAA5 AnalyticalResultValue 22.137 ZIPCODE 35005 Latitude 33.59215 Longitude -86.99833 Name: 199, dtype: object CollectionDate 1519084800.0 Contaminant HAA9 AnalyticalResultValue 27.059 ZIPCODE 35005 Latitude 33.59215 Longitude -86.99833 Name: 200, dtype: object CollectionDate 1519084800.0 Contaminant HAA6Br AnalyticalResultValue 5.299 ZIPCODE 35005 Latitude 33.59215 Longitude -86.99833 Name: 201, dtype: object CollectionDate 1519084800.0 Contaminant HAA5 AnalyticalResultValue 14.354 ZIPCODE 35005 Latitude 33.59215 Longitude -86.99833 Name: 211, dtype: object CollectionDate 1519084800.0 Contaminant HAA9 AnalyticalResultValue 17.263 ZIPCODE 35005 Latitude 33.59215 Longitude -86.99833 Name: 212, dtype: object CollectionDate 1519084800.0 Contaminant HAA6Br AnalyticalResultValue 3.223 ZIPCODE 35005 Latitude 33.59215 Longitude -86.99833 Name: 213, dtype: object CollectionDate 1519084800.0 Contaminant HAA5 AnalyticalResultValue 17.78 ZIPCODE 35005 Latitude 33.59215 Longitude -86.99833 Name: 223, dtype: object CollectionDate 1519084800.0 Contaminant HAA9 AnalyticalResultValue 21.604 ZIPCODE 35005 Latitude 33.59215 Longitude -86.99833 Name: 224, dtype: object CollectionDate 1519084800.0 Contaminant HAA6Br AnalyticalResultValue 3.824 ZIPCODE 35005 Latitude 33.59215 Longitude -86.99833 Name: 225, dtype: object CollectionDate 1527638400.0 Contaminant manganese AnalyticalResultValue 1.05 ZIPCODE 35005 Latitude 33.59215 Longitude -86.99833 Name: 178, dtype: object CollectionDate 1527638400.0 Contaminant HAA5 AnalyticalResultValue 24.706 ZIPCODE 35005 Latitude 33.59215 Longitude -86.99833 Name: 190, dtype: object CollectionDate 1527638400.0 Contaminant HAA9 AnalyticalResultValue 31.547 ZIPCODE 35005 Latitude 33.59215 Longitude -86.99833 Name: 191, dtype: object CollectionDate 1527638400.0 Contaminant HAA6Br AnalyticalResultValue 7.627 ZIPCODE 35005 Latitude 33.59215 Longitude -86.99833 Name: 192, dtype: object CollectionDate 1527638400.0 Contaminant HAA5 AnalyticalResultValue 31.963 ZIPCODE 35005 Latitude 33.59215 Longitude -86.99833 Name: 202, dtype: object CollectionDate 1527638400.0 Contaminant HAA9 AnalyticalResultValue 38.356 ZIPCODE 35005 Latitude 33.59215 Longitude -86.99833 Name: 203, dtype: object CollectionDate 1527638400.0 Contaminant HAA6Br AnalyticalResultValue 6.816 ZIPCODE 35005 Latitude 33.59215 Longitude -86.99833 Name: 204, dtype: object CollectionDate 1527638400.0 Contaminant HAA5 AnalyticalResultValue 13.6 ZIPCODE 35005 Latitude 33.59215 Longitude -86.99833 Name: 214, dtype: object CollectionDate 1527638400.0 Contaminant HAA9 AnalyticalResultValue 16.41 ZIPCODE 35005 Latitude 33.59215 Longitude -86.99833 Name: 215, dtype: object CollectionDate 1527638400.0 Contaminant HAA6Br AnalyticalResultValue 2.81 ZIPCODE 35005 Latitude 33.59215 Longitude -86.99833 Name: 216, dtype: object CollectionDate 1527638400.0 Contaminant HAA5 AnalyticalResultValue 33.97 ZIPCODE 35005 Latitude 33.59215 Longitude -86.99833 Name: 226, dtype: object CollectionDate 1527638400.0 Contaminant HAA9 AnalyticalResultValue 38.4 ZIPCODE 35005 Latitude 33.59215 Longitude -86.99833 Name: 227, dtype: object CollectionDate 1527638400.0 Contaminant HAA6Br AnalyticalResultValue 4.43 ZIPCODE 35005 Latitude 33.59215 Longitude -86.99833 Name: 228, dtype: object CollectionDate 1535414400.0 Contaminant manganese AnalyticalResultValue 3.34 ZIPCODE 35005 Latitude 33.59215 Longitude -86.99833 Name: 179, dtype: object CollectionDate 1535414400.0 Contaminant manganese AnalyticalResultValue 2.44 ZIPCODE 35005 Latitude 33.59215 Longitude -86.99833 Name: 182, dtype: object CollectionDate 1535414400.0 Contaminant manganese AnalyticalResultValue 1.25 ZIPCODE 35005 Latitude 33.59215 Longitude -86.99833 Name: 185, dtype: object CollectionDate 1535414400.0 Contaminant HAA5 AnalyticalResultValue 24.472 ZIPCODE 35005 Latitude 33.59215 Longitude -86.99833 Name: 193, dtype: object CollectionDate 1535414400.0 Contaminant HAA9 AnalyticalResultValue 32.534 ZIPCODE 35005 Latitude 33.59215 Longitude -86.99833 Name: 194, dtype: object CollectionDate 1535414400.0 Contaminant HAA6Br AnalyticalResultValue 8.564 ZIPCODE 35005 Latitude 33.59215 Longitude -86.99833 Name: 195, dtype: object CollectionDate 1535414400.0 Contaminant HAA5 AnalyticalResultValue 21.725 ZIPCODE 35005 Latitude 33.59215 Longitude -86.99833 Name: 205, dtype: object CollectionDate 1535414400.0 Contaminant HAA9 AnalyticalResultValue 26.915 ZIPCODE 35005 Latitude 33.59215 Longitude -86.99833 Name: 206, dtype: object CollectionDate 1535414400.0 Contaminant HAA6Br AnalyticalResultValue 5.555 ZIPCODE 35005 Latitude 33.59215 Longitude -86.99833 Name: 207, dtype: object CollectionDate 1535414400.0 Contaminant HAA5 AnalyticalResultValue 16.02 ZIPCODE 35005 Latitude 33.59215 Longitude -86.99833 Name: 217, dtype: object CollectionDate 1535414400.0 Contaminant HAA9 AnalyticalResultValue 18.407 ZIPCODE 35005 Latitude 33.59215 Longitude -86.99833 Name: 218, dtype: object CollectionDate 1535414400.0 Contaminant HAA6Br AnalyticalResultValue 2.387 ZIPCODE 35005 Latitude 33.59215 Longitude -86.99833 Name: 219, dtype: object CollectionDate 1535414400.0 Contaminant HAA5 AnalyticalResultValue 24.64 ZIPCODE 35005 Latitude 33.59215 Longitude -86.99833 Name: 229, dtype: object CollectionDate 1535414400.0 Contaminant HAA9 AnalyticalResultValue 28.44 ZIPCODE 35005 Latitude 33.59215 Longitude -86.99833 Name: 230, dtype: object CollectionDate 1535414400.0 Contaminant HAA6Br AnalyticalResultValue 3.8 ZIPCODE 35005 Latitude 33.59215 Longitude -86.99833 Name: 231, dtype: object CollectionDate 1541635200.0 Contaminant manganese AnalyticalResultValue 1.12 ZIPCODE 35005 Latitude 33.59215 Longitude -86.99833 Name: 180, dtype: object CollectionDate 1541635200.0 Contaminant manganese AnalyticalResultValue 4.36 ZIPCODE 35005 Latitude 33.59215 Longitude -86.99833 Name: 183, dtype: object CollectionDate 1541635200.0 Contaminant manganese AnalyticalResultValue 0.469 ZIPCODE 35005 Latitude 33.59215 Longitude -86.99833 Name: 186, dtype: object CollectionDate 1541635200.0 Contaminant HAA5 AnalyticalResultValue 18.514 ZIPCODE 35005 Latitude 33.59215 Longitude -86.99833 Name: 196, dtype: object CollectionDate 1541635200.0 Contaminant HAA9 AnalyticalResultValue 24.757 ZIPCODE 35005 Latitude 33.59215 Longitude -86.99833 Name: 197, dtype: object CollectionDate 1541635200.0 Contaminant HAA6Br AnalyticalResultValue 6.657 ZIPCODE 35005 Latitude 33.59215 Longitude -86.99833 Name: 198, dtype: object CollectionDate 1541635200.0 Contaminant HAA5 AnalyticalResultValue 22.864 ZIPCODE 35005 Latitude 33.59215 Longitude -86.99833 Name: 208, dtype: object CollectionDate 1541635200.0 Contaminant HAA9 AnalyticalResultValue 28.022 ZIPCODE 35005 Latitude 33.59215 Longitude -86.99833 Name: 209, dtype: object CollectionDate 1541635200.0 Contaminant HAA6Br AnalyticalResultValue 5.532 ZIPCODE 35005 Latitude 33.59215 Longitude -86.99833 Name: 210, dtype: object CollectionDate 1541635200.0 Contaminant HAA5 AnalyticalResultValue 12.6 ZIPCODE 35005 Latitude 33.59215 Longitude -86.99833 Name: 220, dtype: object CollectionDate 1541635200.0 Contaminant HAA9 AnalyticalResultValue 15.124 ZIPCODE 35005 Latitude 33.59215 Longitude -86.99833 Name: 221, dtype: object CollectionDate 1541635200.0 Contaminant HAA6Br AnalyticalResultValue 2.524 ZIPCODE 35005 Latitude 33.59215 Longitude -86.99833 Name: 222, dtype: object CollectionDate 1541635200.0 Contaminant HAA5 AnalyticalResultValue 19.43 ZIPCODE 35005 Latitude 33.59215 Longitude -86.99833 Name: 232, dtype: object CollectionDate 1541635200.0 Contaminant HAA9 AnalyticalResultValue 22.53 ZIPCODE 35005 Latitude 33.59215 Longitude -86.99833 Name: 233, dtype: object CollectionDate 1541635200.0 Contaminant HAA6Br AnalyticalResultValue 3.1 ZIPCODE 35005 Latitude 33.59215 Longitude -86.99833 Name: 234, dtype: object CollectionDate 1727308800.0 Contaminant PFPeA AnalyticalResultValue 0.0056 ZIPCODE 35005 Latitude 33.59215 Longitude -86.99833 Name: 368, dtype: object CollectionDate 1727308800.0 Contaminant 6:2 FTS AnalyticalResultValue 0.0058 ZIPCODE 35005 Latitude 33.59215 Longitude -86.99833 Name: 369, dtype: object CollectionDate 1727308800.0 Contaminant PFHxA AnalyticalResultValue 0.0085 ZIPCODE 35005 Latitude 33.59215 Longitude -86.99833 Name: 370, dtype: object CollectionDate 1727308800.0 Contaminant PFBS AnalyticalResultValue 0.0055 ZIPCODE 35005 Latitude 33.59215 Longitude -86.99833 Name: 371, dtype: object CollectionDate 1376524800.0 Contaminant molybdenum AnalyticalResultValue 1.0 ZIPCODE 48858 Latitude 43.61483 Longitude -84.79576 Name: 132, dtype: object CollectionDate 1376524800.0 Contaminant strontium AnalyticalResultValue 470.0 ZIPCODE 48858 Latitude 43.61483 Longitude -84.79576 Name: 133, dtype: object CollectionDate 1376524800.0 Contaminant chlorate AnalyticalResultValue 580.0 ZIPCODE 48858 Latitude 43.61483 Longitude -84.79576 Name: 142, dtype: object CollectionDate 1376524800.0 Contaminant strontium AnalyticalResultValue 390.0 ZIPCODE 48858 Latitude 43.61483 Longitude -84.79576 Name: 143, dtype: object CollectionDate 1376524800.0 Contaminant strontium AnalyticalResultValue 420.0 ZIPCODE 48858 Latitude 43.61483 Longitude -84.79576 Name: 146, dtype: object CollectionDate 1376524800.0 Contaminant strontium AnalyticalResultValue 470.0 ZIPCODE 48858 Latitude 43.61483 Longitude -84.79576 Name: 151, dtype: object CollectionDate 1376956800.0 Contaminant chlorate AnalyticalResultValue 770.0 ZIPCODE 48858 Latitude 43.61483 Longitude -84.79576 Name: 89, dtype: object CollectionDate 1376956800.0 Contaminant chromium AnalyticalResultValue 0.4 ZIPCODE 48858 Latitude 43.61483 Longitude -84.79576 Name: 90, dtype: object CollectionDate 1376956800.0 Contaminant strontium AnalyticalResultValue 410.0 ZIPCODE 48858 Latitude 43.61483 Longitude -84.79576 Name: 91, dtype: object CollectionDate 1376956800.0 Contaminant molybdenum AnalyticalResultValue 1.4 ZIPCODE 48858 Latitude 43.61483 Longitude -84.79576 Name: 92, dtype: object CollectionDate 1376956800.0 Contaminant chromium-6 AnalyticalResultValue 0.38 ZIPCODE 48858 Latitude 43.61483 Longitude -84.79576 Name: 93, dtype: object CollectionDate 1376956800.0 Contaminant strontium AnalyticalResultValue 470.0 ZIPCODE 48858 Latitude 43.61483 Longitude -84.79576 Name: 110, dtype: object CollectionDate 1376956800.0 Contaminant chromium AnalyticalResultValue 0.3 ZIPCODE 48858 Latitude 43.61483 Longitude -84.79576 Name: 111, dtype: object CollectionDate 1376956800.0 Contaminant molybdenum AnalyticalResultValue 1.5 ZIPCODE 48858 Latitude 43.61483 Longitude -84.79576 Name: 112, dtype: object CollectionDate 1376956800.0 Contaminant chromium-6 AnalyticalResultValue 0.31 ZIPCODE 48858 Latitude 43.61483 Longitude -84.79576 Name: 113, dtype: object CollectionDate 1376956800.0 Contaminant chlorate AnalyticalResultValue 680.0 ZIPCODE 48858 Latitude 43.61483 Longitude -84.79576 Name: 114, dtype: object CollectionDate 1376956800.0 Contaminant chlorate AnalyticalResultValue 170.0 ZIPCODE 48858 Latitude 43.61483 Longitude -84.79576 Name: 138, dtype: object CollectionDate 1378771200.0 Contaminant strontium AnalyticalResultValue 460.0 ZIPCODE 48858 Latitude 43.61483 Longitude -84.79576 Name: 137, dtype: object CollectionDate 1378944000.0 Contaminant chromium-6 AnalyticalResultValue 0.19 ZIPCODE 48858 Latitude 43.61483 Longitude -84.79576 Name: 134, dtype: object CollectionDate 1384819200.0 Contaminant chromium AnalyticalResultValue 0.4 ZIPCODE 48858 Latitude 43.61483 Longitude -84.79576 Name: 94, dtype: object CollectionDate 1384819200.0 Contaminant chlorate AnalyticalResultValue 440.0 ZIPCODE 48858 Latitude 43.61483 Longitude -84.79576 Name: 95, dtype: object CollectionDate 1384819200.0 Contaminant chromium-6 AnalyticalResultValue 0.38 ZIPCODE 48858 Latitude 43.61483 Longitude -84.79576 Name: 96, dtype: object CollectionDate 1384819200.0 Contaminant molybdenum AnalyticalResultValue 1.3 ZIPCODE 48858 Latitude 43.61483 Longitude -84.79576 Name: 97, dtype: object CollectionDate 1384819200.0 Contaminant strontium AnalyticalResultValue 200.0 ZIPCODE 48858 Latitude 43.61483 Longitude -84.79576 Name: 98, dtype: object CollectionDate 1384819200.0 Contaminant vanadium AnalyticalResultValue 0.2 ZIPCODE 48858 Latitude 43.61483 Longitude -84.79576 Name: 115, dtype: object CollectionDate 1384819200.0 Contaminant molybdenum AnalyticalResultValue 1.4 ZIPCODE 48858 Latitude 43.61483 Longitude -84.79576 Name: 116, dtype: object CollectionDate 1384819200.0 Contaminant chromium AnalyticalResultValue 0.4 ZIPCODE 48858 Latitude 43.61483 Longitude -84.79576 Name: 117, dtype: object CollectionDate 1384819200.0 Contaminant chlorate AnalyticalResultValue 350.0 ZIPCODE 48858 Latitude 43.61483 Longitude -84.79576 Name: 118, dtype: object CollectionDate 1384819200.0 Contaminant strontium AnalyticalResultValue 170.0 ZIPCODE 48858 Latitude 43.61483 Longitude -84.79576 Name: 119, dtype: object CollectionDate 1384819200.0 Contaminant chromium-6 AnalyticalResultValue 0.42 ZIPCODE 48858 Latitude 43.61483 Longitude -84.79576 Name: 120, dtype: object CollectionDate 1392163200.0 Contaminant strontium AnalyticalResultValue 500.0 ZIPCODE 48858 Latitude 43.61483 Longitude -84.79576 Name: 144, dtype: object CollectionDate 1392163200.0 Contaminant chlorate AnalyticalResultValue 99.0 ZIPCODE 48858 Latitude 43.61483 Longitude -84.79576 Name: 145, dtype: object CollectionDate 1392163200.0 Contaminant strontium AnalyticalResultValue 400.0 ZIPCODE 48858 Latitude 43.61483 Longitude -84.79576 Name: 147, dtype: object CollectionDate 1392768000.0 Contaminant strontium AnalyticalResultValue 540.0 ZIPCODE 48858 Latitude 43.61483 Longitude -84.79576 Name: 135, dtype: object CollectionDate 1392768000.0 Contaminant chlorate AnalyticalResultValue 140.0 ZIPCODE 48858 Latitude 43.61483 Longitude -84.79576 Name: 136, dtype: object CollectionDate 1392768000.0 Contaminant strontium AnalyticalResultValue 510.0 ZIPCODE 48858 Latitude 43.61483 Longitude -84.79576 Name: 139, dtype: object CollectionDate 1392768000.0 Contaminant molybdenum AnalyticalResultValue 1.0 ZIPCODE 48858 Latitude 43.61483 Longitude -84.79576 Name: 140, dtype: object CollectionDate 1392768000.0 Contaminant chlorate AnalyticalResultValue 69.0 ZIPCODE 48858 Latitude 43.61483 Longitude -84.79576 Name: 141, dtype: object CollectionDate 1392768000.0 Contaminant molybdenum AnalyticalResultValue 1.0 ZIPCODE 48858 Latitude 43.61483 Longitude -84.79576 Name: 148, dtype: object CollectionDate 1392768000.0 Contaminant strontium AnalyticalResultValue 480.0 ZIPCODE 48858 Latitude 43.61483 Longitude -84.79576 Name: 149, dtype: object CollectionDate 1392768000.0 Contaminant chlorate AnalyticalResultValue 27.0 ZIPCODE 48858 Latitude 43.61483 Longitude -84.79576 Name: 150, dtype: object CollectionDate 1392768000.0 Contaminant strontium AnalyticalResultValue 540.0 ZIPCODE 48858 Latitude 43.61483 Longitude -84.79576 Name: 152, dtype: object CollectionDate 1393200000.0 Contaminant chromium AnalyticalResultValue 0.4 ZIPCODE 48858 Latitude 43.61483 Longitude -84.79576 Name: 99, dtype: object CollectionDate 1393200000.0 Contaminant strontium AnalyticalResultValue 250.0 ZIPCODE 48858 Latitude 43.61483 Longitude -84.79576 Name: 100, dtype: object CollectionDate 1393200000.0 Contaminant molybdenum AnalyticalResultValue 1.4 ZIPCODE 48858 Latitude 43.61483 Longitude -84.79576 Name: 101, dtype: object CollectionDate 1393200000.0 Contaminant chromium-6 AnalyticalResultValue 0.42 ZIPCODE 48858 Latitude 43.61483 Longitude -84.79576 Name: 102, dtype: object CollectionDate 1393200000.0 Contaminant chlorate AnalyticalResultValue 300.0 ZIPCODE 48858 Latitude 43.61483 Longitude -84.79576 Name: 103, dtype: object CollectionDate 1393200000.0 Contaminant chromium-6 AnalyticalResultValue 0.47 ZIPCODE 48858 Latitude 43.61483 Longitude -84.79576 Name: 121, dtype: object CollectionDate 1393200000.0 Contaminant chlorate AnalyticalResultValue 270.0 ZIPCODE 48858 Latitude 43.61483 Longitude -84.79576 Name: 122, dtype: object CollectionDate 1393200000.0 Contaminant strontium AnalyticalResultValue 230.0 ZIPCODE 48858 Latitude 43.61483 Longitude -84.79576 Name: 123, dtype: object CollectionDate 1393200000.0 Contaminant chromium AnalyticalResultValue 0.5 ZIPCODE 48858 Latitude 43.61483 Longitude -84.79576 Name: 124, dtype: object CollectionDate 1393200000.0 Contaminant molybdenum AnalyticalResultValue 1.4 ZIPCODE 48858 Latitude 43.61483 Longitude -84.79576 Name: 125, dtype: object CollectionDate 1401753600.0 Contaminant chromium-6 AnalyticalResultValue 0.37 ZIPCODE 48858 Latitude 43.61483 Longitude -84.79576 Name: 104, dtype: object CollectionDate 1401753600.0 Contaminant chlorate AnalyticalResultValue 250.0 ZIPCODE 48858 Latitude 43.61483 Longitude -84.79576 Name: 105, dtype: object CollectionDate 1401753600.0 Contaminant vanadium AnalyticalResultValue 0.3 ZIPCODE 48858 Latitude 43.61483 Longitude -84.79576 Name: 106, dtype: object CollectionDate 1401753600.0 Contaminant strontium AnalyticalResultValue 400.0 ZIPCODE 48858 Latitude 43.61483 Longitude -84.79576 Name: 107, dtype: object CollectionDate 1401753600.0 Contaminant chromium AnalyticalResultValue 0.4 ZIPCODE 48858 Latitude 43.61483 Longitude -84.79576 Name: 108, dtype: object CollectionDate 1401753600.0 Contaminant molybdenum AnalyticalResultValue 1.3 ZIPCODE 48858 Latitude 43.61483 Longitude -84.79576 Name: 109, dtype: object CollectionDate 1401753600.0 Contaminant chromium AnalyticalResultValue 0.5 ZIPCODE 48858 Latitude 43.61483 Longitude -84.79576 Name: 126, dtype: object CollectionDate 1401753600.0 Contaminant strontium AnalyticalResultValue 220.0 ZIPCODE 48858 Latitude 43.61483 Longitude -84.79576 Name: 127, dtype: object CollectionDate 1401753600.0 Contaminant chromium-6 AnalyticalResultValue 0.48 ZIPCODE 48858 Latitude 43.61483 Longitude -84.79576 Name: 128, dtype: object CollectionDate 1401753600.0 Contaminant molybdenum AnalyticalResultValue 1.3 ZIPCODE 48858 Latitude 43.61483 Longitude -84.79576 Name: 129, dtype: object CollectionDate 1401753600.0 Contaminant chlorate AnalyticalResultValue 300.0 ZIPCODE 48858 Latitude 43.61483 Longitude -84.79576 Name: 130, dtype: object CollectionDate 1401753600.0 Contaminant vanadium AnalyticalResultValue 0.3 ZIPCODE 48858 Latitude 43.61483 Longitude -84.79576 Name: 131, dtype: object CollectionDate 1415750400.0 Contaminant molybdenum AnalyticalResultValue 2.0 ZIPCODE 48858 Latitude 43.61483 Longitude -84.79576 Name: 31, dtype: object CollectionDate 1415750400.0 Contaminant chromium-6 AnalyticalResultValue 0.43 ZIPCODE 48858 Latitude 43.61483 Longitude -84.79576 Name: 32, dtype: object CollectionDate 1415750400.0 Contaminant chromium AnalyticalResultValue 0.5 ZIPCODE 48858 Latitude 43.61483 Longitude -84.79576 Name: 33, dtype: object CollectionDate 1415750400.0 Contaminant vanadium AnalyticalResultValue 0.2 ZIPCODE 48858 Latitude 43.61483 Longitude -84.79576 Name: 34, dtype: object CollectionDate 1415750400.0 Contaminant chlorate AnalyticalResultValue 200.0 ZIPCODE 48858 Latitude 43.61483 Longitude -84.79576 Name: 35, dtype: object CollectionDate 1415750400.0 Contaminant strontium AnalyticalResultValue 290.0 ZIPCODE 48858 Latitude 43.61483 Longitude -84.79576 Name: 36, dtype: object CollectionDate 1415750400.0 Contaminant chromium AnalyticalResultValue 1.0 ZIPCODE 48858 Latitude 43.61483 Longitude -84.79576 Name: 43, dtype: object CollectionDate 1415750400.0 Contaminant strontium AnalyticalResultValue 640.0 ZIPCODE 48858 Latitude 43.61483 Longitude -84.79576 Name: 44, dtype: object CollectionDate 1415750400.0 Contaminant molybdenum AnalyticalResultValue 2.7 ZIPCODE 48858 Latitude 43.61483 Longitude -84.79576 Name: 45, dtype: object CollectionDate 1415750400.0 Contaminant chromium-6 AnalyticalResultValue 0.31 ZIPCODE 48858 Latitude 43.61483 Longitude -84.79576 Name: 46, dtype: object CollectionDate 1415750400.0 Contaminant chlorate AnalyticalResultValue 410.0 ZIPCODE 48858 Latitude 43.61483 Longitude -84.79576 Name: 47, dtype: object CollectionDate 1431475200.0 Contaminant strontium AnalyticalResultValue 230.0 ZIPCODE 48858 Latitude 43.61483 Longitude -84.79576 Name: 37, dtype: object CollectionDate 1431475200.0 Contaminant chromium AnalyticalResultValue 0.5 ZIPCODE 48858 Latitude 43.61483 Longitude -84.79576 Name: 38, dtype: object CollectionDate 1431475200.0 Contaminant vanadium AnalyticalResultValue 0.2 ZIPCODE 48858 Latitude 43.61483 Longitude -84.79576 Name: 39, dtype: object CollectionDate 1431475200.0 Contaminant molybdenum AnalyticalResultValue 2.2 ZIPCODE 48858 Latitude 43.61483 Longitude -84.79576 Name: 40, dtype: object CollectionDate 1431475200.0 Contaminant chromium-6 AnalyticalResultValue 0.45 ZIPCODE 48858 Latitude 43.61483 Longitude -84.79576 Name: 41, dtype: object CollectionDate 1431475200.0 Contaminant chlorate AnalyticalResultValue 260.0 ZIPCODE 48858 Latitude 43.61483 Longitude -84.79576 Name: 42, dtype: object CollectionDate 1431475200.0 Contaminant chromium-6 AnalyticalResultValue 0.37 ZIPCODE 48858 Latitude 43.61483 Longitude -84.79576 Name: 48, dtype: object CollectionDate 1431475200.0 Contaminant chlorate AnalyticalResultValue 230.0 ZIPCODE 48858 Latitude 43.61483 Longitude -84.79576 Name: 52, dtype: object CollectionDate 1436313600.0 Contaminant molybdenum AnalyticalResultValue 2.1 ZIPCODE 48858 Latitude 43.61483 Longitude -84.79576 Name: 49, dtype: object CollectionDate 1436313600.0 Contaminant chromium AnalyticalResultValue 0.5 ZIPCODE 48858 Latitude 43.61483 Longitude -84.79576 Name: 50, dtype: object CollectionDate 1436313600.0 Contaminant strontium AnalyticalResultValue 260.0 ZIPCODE 48858 Latitude 43.61483 Longitude -84.79576 Name: 51, dtype: object CollectionDate 1436313600.0 Contaminant vanadium AnalyticalResultValue 0.2 ZIPCODE 48858 Latitude 43.61483 Longitude -84.79576 Name: 53, dtype: object CollectionDate 1539129600.0 Contaminant HAA9 AnalyticalResultValue 2.858 ZIPCODE 48858 Latitude 43.61483 Longitude -84.79576 Name: 153, dtype: object CollectionDate 1539129600.0 Contaminant HAA6Br AnalyticalResultValue 2.858 ZIPCODE 48858 Latitude 43.61483 Longitude -84.79576 Name: 154, dtype: object CollectionDate 1539129600.0 Contaminant HAA5 AnalyticalResultValue 1.73 ZIPCODE 48858 Latitude 43.61483 Longitude -84.79576 Name: 155, dtype: object CollectionDate 1539734400.0 Contaminant HAA9 AnalyticalResultValue 3.936 ZIPCODE 48858 Latitude 43.61483 Longitude -84.79576 Name: 159, dtype: object CollectionDate 1539734400.0 Contaminant HAA6Br AnalyticalResultValue 2.516 ZIPCODE 48858 Latitude 43.61483 Longitude -84.79576 Name: 160, dtype: object CollectionDate 1539734400.0 Contaminant HAA5 AnalyticalResultValue 2.219 ZIPCODE 48858 Latitude 43.61483 Longitude -84.79576 Name: 161, dtype: object CollectionDate 1546473600.0 Contaminant HAA9 AnalyticalResultValue 19.1 ZIPCODE 48858 Latitude 43.61483 Longitude -84.79576 Name: 263, dtype: object CollectionDate 1546473600.0 Contaminant HAA5 AnalyticalResultValue 9.5 ZIPCODE 48858 Latitude 43.61483 Longitude -84.79576 Name: 264, dtype: object CollectionDate 1546473600.0 Contaminant HAA6Br AnalyticalResultValue 11.8 ZIPCODE 48858 Latitude 43.61483 Longitude -84.79576 Name: 265, dtype: object CollectionDate 1546473600.0 Contaminant HAA9 AnalyticalResultValue 24.37 ZIPCODE 48858 Latitude 43.61483 Longitude -84.79576 Name: 272, dtype: object CollectionDate 1546473600.0 Contaminant HAA5 AnalyticalResultValue 15.27 ZIPCODE 48858 Latitude 43.61483 Longitude -84.79576 Name: 273, dtype: object CollectionDate 1546473600.0 Contaminant HAA6Br AnalyticalResultValue 12.27 ZIPCODE 48858 Latitude 43.61483 Longitude -84.79576 Name: 274, dtype: object CollectionDate 1546473600.0 Contaminant HAA9 AnalyticalResultValue 26.21 ZIPCODE 48858 Latitude 43.61483 Longitude -84.79576 Name: 281, dtype: object CollectionDate 1546473600.0 Contaminant HAA5 AnalyticalResultValue 14.81 ZIPCODE 48858 Latitude 43.61483 Longitude -84.79576 Name: 282, dtype: object CollectionDate 1546473600.0 Contaminant HAA6Br AnalyticalResultValue 14.41 ZIPCODE 48858 Latitude 43.61483 Longitude -84.79576 Name: 283, dtype: object CollectionDate 1546473600.0 Contaminant HAA9 AnalyticalResultValue 26.99 ZIPCODE 48858 Latitude 43.61483 Longitude -84.79576 Name: 290, dtype: object CollectionDate 1546473600.0 Contaminant HAA5 AnalyticalResultValue 15.29 ZIPCODE 48858 Latitude 43.61483 Longitude -84.79576 Name: 291, dtype: object CollectionDate 1546473600.0 Contaminant HAA6Br AnalyticalResultValue 14.89 ZIPCODE 48858 Latitude 43.61483 Longitude -84.79576 Name: 292, dtype: object CollectionDate 1546473600.0 Contaminant manganese AnalyticalResultValue 0.61 ZIPCODE 48858 Latitude 43.61483 Longitude -84.79576 Name: 299, dtype: object CollectionDate 1554249600.0 Contaminant HAA9 AnalyticalResultValue 6.903 ZIPCODE 48858 Latitude 43.61483 Longitude -84.79576 Name: 156, dtype: object CollectionDate 1554249600.0 Contaminant HAA6Br AnalyticalResultValue 6.485 ZIPCODE 48858 Latitude 43.61483 Longitude -84.79576 Name: 157, dtype: object CollectionDate 1554249600.0 Contaminant HAA5 AnalyticalResultValue 3.01 ZIPCODE 48858 Latitude 43.61483 Longitude -84.79576 Name: 158, dtype: object CollectionDate 1554249600.0 Contaminant HAA9 AnalyticalResultValue 3.476 ZIPCODE 48858 Latitude 43.61483 Longitude -84.79576 Name: 162, dtype: object CollectionDate 1554249600.0 Contaminant HAA6Br AnalyticalResultValue 3.136 ZIPCODE 48858 Latitude 43.61483 Longitude -84.79576 Name: 163, dtype: object CollectionDate 1554249600.0 Contaminant HAA5 AnalyticalResultValue 2.095 ZIPCODE 48858 Latitude 43.61483 Longitude -84.79576 Name: 164, dtype: object CollectionDate 1562025600.0 Contaminant HAA9 AnalyticalResultValue 17.13 ZIPCODE 48858 Latitude 43.61483 Longitude -84.79576 Name: 266, dtype: object CollectionDate 1562025600.0 Contaminant HAA5 AnalyticalResultValue 6.83 ZIPCODE 48858 Latitude 43.61483 Longitude -84.79576 Name: 267, dtype: object CollectionDate 1562025600.0 Contaminant HAA6Br AnalyticalResultValue 12.63 ZIPCODE 48858 Latitude 43.61483 Longitude -84.79576 Name: 268, dtype: object CollectionDate 1562025600.0 Contaminant HAA9 AnalyticalResultValue 21.73 ZIPCODE 48858 Latitude 43.61483 Longitude -84.79576 Name: 275, dtype: object CollectionDate 1562025600.0 Contaminant HAA5 AnalyticalResultValue 10.23 ZIPCODE 48858 Latitude 43.61483 Longitude -84.79576 Name: 276, dtype: object CollectionDate 1562025600.0 Contaminant HAA6Br AnalyticalResultValue 16.03 ZIPCODE 48858 Latitude 43.61483 Longitude -84.79576 Name: 277, dtype: object CollectionDate 1562025600.0 Contaminant HAA9 AnalyticalResultValue 21.45 ZIPCODE 48858 Latitude 43.61483 Longitude -84.79576 Name: 284, dtype: object CollectionDate 1562025600.0 Contaminant HAA5 AnalyticalResultValue 9.85 ZIPCODE 48858 Latitude 43.61483 Longitude -84.79576 Name: 285, dtype: object CollectionDate 1562025600.0 Contaminant HAA6Br AnalyticalResultValue 15.85 ZIPCODE 48858 Latitude 43.61483 Longitude -84.79576 Name: 286, dtype: object CollectionDate 1562025600.0 Contaminant HAA9 AnalyticalResultValue 22.85 ZIPCODE 48858 Latitude 43.61483 Longitude -84.79576 Name: 293, dtype: object CollectionDate 1562025600.0 Contaminant HAA5 AnalyticalResultValue 11.05 ZIPCODE 48858 Latitude 43.61483 Longitude -84.79576 Name: 294, dtype: object CollectionDate 1562025600.0 Contaminant HAA6Br AnalyticalResultValue 16.35 ZIPCODE 48858 Latitude 43.61483 Longitude -84.79576 Name: 295, dtype: object CollectionDate 1562025600.0 Contaminant manganese AnalyticalResultValue 1.3 ZIPCODE 48858 Latitude 43.61483 Longitude -84.79576 Name: 300, dtype: object CollectionDate 1570579200.0 Contaminant HAA9 AnalyticalResultValue 25.52 ZIPCODE 48858 Latitude 43.61483 Longitude -84.79576 Name: 269, dtype: object CollectionDate 1570579200.0 Contaminant HAA5 AnalyticalResultValue 12.92 ZIPCODE 48858 Latitude 43.61483 Longitude -84.79576 Name: 270, dtype: object CollectionDate 1570579200.0 Contaminant HAA6Br AnalyticalResultValue 17.82 ZIPCODE 48858 Latitude 43.61483 Longitude -84.79576 Name: 271, dtype: object CollectionDate 1570579200.0 Contaminant HAA9 AnalyticalResultValue 24.19 ZIPCODE 48858 Latitude 43.61483 Longitude -84.79576 Name: 278, dtype: object CollectionDate 1570579200.0 Contaminant HAA5 AnalyticalResultValue 12.69 ZIPCODE 48858 Latitude 43.61483 Longitude -84.79576 Name: 279, dtype: object CollectionDate 1570579200.0 Contaminant HAA6Br AnalyticalResultValue 15.69 ZIPCODE 48858 Latitude 43.61483 Longitude -84.79576 Name: 280, dtype: object CollectionDate 1570579200.0 Contaminant HAA9 AnalyticalResultValue 24.76 ZIPCODE 48858 Latitude 43.61483 Longitude -84.79576 Name: 287, dtype: object CollectionDate 1570579200.0 Contaminant HAA5 AnalyticalResultValue 12.96 ZIPCODE 48858 Latitude 43.61483 Longitude -84.79576 Name: 288, dtype: object CollectionDate 1570579200.0 Contaminant HAA6Br AnalyticalResultValue 15.96 ZIPCODE 48858 Latitude 43.61483 Longitude -84.79576 Name: 289, dtype: object CollectionDate 1570579200.0 Contaminant HAA9 AnalyticalResultValue 25.87 ZIPCODE 48858 Latitude 43.61483 Longitude -84.79576 Name: 296, dtype: object CollectionDate 1570579200.0 Contaminant HAA5 AnalyticalResultValue 13.77 ZIPCODE 48858 Latitude 43.61483 Longitude -84.79576 Name: 297, dtype: object CollectionDate 1570579200.0 Contaminant HAA6Br AnalyticalResultValue 16.37 ZIPCODE 48858 Latitude 43.61483 Longitude -84.79576 Name: 298, dtype: object CollectionDate 1583712000.0 Contaminant manganese AnalyticalResultValue 2.5 ZIPCODE 48858 Latitude 43.61483 Longitude -84.79576 Name: 301, dtype: object CollectionDate 1583712000.0 Contaminant manganese AnalyticalResultValue 52.4 ZIPCODE 48858 Latitude 43.61483 Longitude -84.79576 Name: 308, dtype: object CollectionDate 1583712000.0 Contaminant manganese AnalyticalResultValue 31.7 ZIPCODE 48858 Latitude 43.61483 Longitude -84.79576 Name: 311, dtype: object CollectionDate 1600128000.0 Contaminant HAA5 AnalyticalResultValue 2.5 ZIPCODE 48858 Latitude 43.61483 Longitude -84.79576 Name: 302, dtype: object CollectionDate 1600128000.0 Contaminant HAA9 AnalyticalResultValue 4.2 ZIPCODE 48858 Latitude 43.61483 Longitude -84.79576 Name: 303, dtype: object CollectionDate 1600128000.0 Contaminant HAA6Br AnalyticalResultValue 3.2 ZIPCODE 48858 Latitude 43.61483 Longitude -84.79576 Name: 304, dtype: object CollectionDate 1600128000.0 Contaminant HAA5 AnalyticalResultValue 5.6 ZIPCODE 48858 Latitude 43.61483 Longitude -84.79576 Name: 305, dtype: object CollectionDate 1600128000.0 Contaminant HAA9 AnalyticalResultValue 15.8 ZIPCODE 48858 Latitude 43.61483 Longitude -84.79576 Name: 306, dtype: object CollectionDate 1600128000.0 Contaminant HAA6Br AnalyticalResultValue 11.4 ZIPCODE 48858 Latitude 43.61483 Longitude -84.79576 Name: 307, dtype: object CollectionDate 1600128000.0 Contaminant manganese AnalyticalResultValue 110.0 ZIPCODE 48858 Latitude 43.61483 Longitude -84.79576 Name: 309, dtype: object CollectionDate 1600128000.0 Contaminant 2-methoxyethanol AnalyticalResultValue 26.3 ZIPCODE 48858 Latitude 43.61483 Longitude -84.79576 Name: 310, dtype: object CollectionDate 1600128000.0 Contaminant manganese AnalyticalResultValue 15.9 ZIPCODE 48858 Latitude 43.61483 Longitude -84.79576 Name: 312, dtype: object CollectionDate 1600128000.0 Contaminant 2-methoxyethanol AnalyticalResultValue 5.1 ZIPCODE 48858 Latitude 43.61483 Longitude -84.79576 Name: 313, dtype: object CollectionDate 1686787200.0 Contaminant PFBS AnalyticalResultValue 0.0033 ZIPCODE 48858 Latitude 43.61483 Longitude -84.79576 Name: 372, dtype: object CollectionDate 1686787200.0 Contaminant lithium AnalyticalResultValue 9.43 ZIPCODE 48858 Latitude 43.61483 Longitude -84.79576 Name: 374, dtype: object CollectionDate 1701820800.0 Contaminant PFBS AnalyticalResultValue 0.0048 ZIPCODE 48858 Latitude 43.61483 Longitude -84.79576 Name: 373, dtype: object CollectionDate 1520294400.0 Contaminant HAA9 AnalyticalResultValue 0.21 ZIPCODE 56633 Latitude 47.31957 Longitude -94.50911 Name: 165, dtype: object CollectionDate 1520294400.0 Contaminant HAA6Br AnalyticalResultValue 0.0 ZIPCODE 56633 Latitude 47.31957 Longitude -94.50911 Name: 166, dtype: object CollectionDate 1520294400.0 Contaminant HAA5 AnalyticalResultValue 0.21 ZIPCODE 56633 Latitude 47.31957 Longitude -94.50911 Name: 167, dtype: object CollectionDate 1520294400.0 Contaminant HAA9 AnalyticalResultValue 0.8 ZIPCODE 56633 Latitude 47.31957 Longitude -94.50911 Name: 171, dtype: object CollectionDate 1520294400.0 Contaminant HAA6Br AnalyticalResultValue 0.45 ZIPCODE 56633 Latitude 47.31957 Longitude -94.50911 Name: 172, dtype: object CollectionDate 1520294400.0 Contaminant HAA5 AnalyticalResultValue 0.35 ZIPCODE 56633 Latitude 47.31957 Longitude -94.50911 Name: 173, dtype: object CollectionDate 1536105600.0 Contaminant HAA9 AnalyticalResultValue 0.0 ZIPCODE 56633 Latitude 47.31957 Longitude -94.50911 Name: 168, dtype: object CollectionDate 1536105600.0 Contaminant HAA6Br AnalyticalResultValue 0.0 ZIPCODE 56633 Latitude 47.31957 Longitude -94.50911 Name: 169, dtype: object CollectionDate 1536105600.0 Contaminant HAA5 AnalyticalResultValue 0.0 ZIPCODE 56633 Latitude 47.31957 Longitude -94.50911 Name: 170, dtype: object CollectionDate 1536105600.0 Contaminant HAA9 AnalyticalResultValue 0.5 ZIPCODE 56633 Latitude 47.31957 Longitude -94.50911 Name: 174, dtype: object CollectionDate 1536105600.0 Contaminant HAA6Br AnalyticalResultValue 0.0 ZIPCODE 56633 Latitude 47.31957 Longitude -94.50911 Name: 175, dtype: object CollectionDate 1536105600.0 Contaminant HAA5 AnalyticalResultValue 0.5 ZIPCODE 56633 Latitude 47.31957 Longitude -94.50911 Name: 176, dtype: object CollectionDate 1709510400.0 Contaminant lithium AnalyticalResultValue 21.5 ZIPCODE 82520 Latitude 42.65919 Longitude -108.63282 Name: 367, dtype: object CollectionDate 1718668800.0 Contaminant PFOA AnalyticalResultValue 0.0093 ZIPCODE 82520 Latitude 42.65919 Longitude -108.63282 Name: 366, dtype: object CollectionDate 1526860800.0 Contaminant HAA9 AnalyticalResultValue 10.5 ZIPCODE 98221 Latitude 48.50401 Longitude -122.65435 Name: 314, dtype: object CollectionDate 1526860800.0 Contaminant HAA5 AnalyticalResultValue 10.0 ZIPCODE 98221 Latitude 48.50401 Longitude -122.65435 Name: 315, dtype: object CollectionDate 1526860800.0 Contaminant HAA6Br AnalyticalResultValue 0.5 ZIPCODE 98221 Latitude 48.50401 Longitude -122.65435 Name: 316, dtype: object CollectionDate 1526860800.0 Contaminant HAA9 AnalyticalResultValue 10.3 ZIPCODE 98221 Latitude 48.50401 Longitude -122.65435 Name: 326, dtype: object CollectionDate 1526860800.0 Contaminant HAA5 AnalyticalResultValue 9.8 ZIPCODE 98221 Latitude 48.50401 Longitude -122.65435 Name: 327, dtype: object CollectionDate 1526860800.0 Contaminant HAA6Br AnalyticalResultValue 0.5 ZIPCODE 98221 Latitude 48.50401 Longitude -122.65435 Name: 328, dtype: object CollectionDate 1526860800.0 Contaminant HAA5 AnalyticalResultValue 11.7 ZIPCODE 98221 Latitude 48.50401 Longitude -122.65435 Name: 338, dtype: object CollectionDate 1526860800.0 Contaminant HAA6Br AnalyticalResultValue 0.5 ZIPCODE 98221 Latitude 48.50401 Longitude -122.65435 Name: 339, dtype: object CollectionDate 1526860800.0 Contaminant HAA9 AnalyticalResultValue 12.2 ZIPCODE 98221 Latitude 48.50401 Longitude -122.65435 Name: 340, dtype: object CollectionDate 1526860800.0 Contaminant HAA5 AnalyticalResultValue 10.7 ZIPCODE 98221 Latitude 48.50401 Longitude -122.65435 Name: 350, dtype: object CollectionDate 1526860800.0 Contaminant HAA6Br AnalyticalResultValue 0.5 ZIPCODE 98221 Latitude 48.50401 Longitude -122.65435 Name: 351, dtype: object CollectionDate 1526860800.0 Contaminant HAA9 AnalyticalResultValue 11.2 ZIPCODE 98221 Latitude 48.50401 Longitude -122.65435 Name: 352, dtype: object CollectionDate 1526860800.0 Contaminant manganese AnalyticalResultValue 2.4 ZIPCODE 98221 Latitude 48.50401 Longitude -122.65435 Name: 362, dtype: object CollectionDate 1534723200.0 Contaminant HAA9 AnalyticalResultValue 8.9 ZIPCODE 98221 Latitude 48.50401 Longitude -122.65435 Name: 317, dtype: object CollectionDate 1534723200.0 Contaminant HAA5 AnalyticalResultValue 8.1 ZIPCODE 98221 Latitude 48.50401 Longitude -122.65435 Name: 318, dtype: object CollectionDate 1534723200.0 Contaminant HAA6Br AnalyticalResultValue 0.8 ZIPCODE 98221 Latitude 48.50401 Longitude -122.65435 Name: 319, dtype: object CollectionDate 1534723200.0 Contaminant HAA9 AnalyticalResultValue 14.1 ZIPCODE 98221 Latitude 48.50401 Longitude -122.65435 Name: 329, dtype: object CollectionDate 1534723200.0 Contaminant HAA5 AnalyticalResultValue 13.3 ZIPCODE 98221 Latitude 48.50401 Longitude -122.65435 Name: 330, dtype: object CollectionDate 1534723200.0 Contaminant HAA6Br AnalyticalResultValue 0.8 ZIPCODE 98221 Latitude 48.50401 Longitude -122.65435 Name: 331, dtype: object CollectionDate 1534723200.0 Contaminant HAA5 AnalyticalResultValue 12.1 ZIPCODE 98221 Latitude 48.50401 Longitude -122.65435 Name: 341, dtype: object CollectionDate 1534723200.0 Contaminant HAA6Br AnalyticalResultValue 0.9 ZIPCODE 98221 Latitude 48.50401 Longitude -122.65435 Name: 342, dtype: object CollectionDate 1534723200.0 Contaminant HAA9 AnalyticalResultValue 13.0 ZIPCODE 98221 Latitude 48.50401 Longitude -122.65435 Name: 343, dtype: object CollectionDate 1534723200.0 Contaminant HAA5 AnalyticalResultValue 8.2 ZIPCODE 98221 Latitude 48.50401 Longitude -122.65435 Name: 353, dtype: object CollectionDate 1534723200.0 Contaminant HAA6Br AnalyticalResultValue 0.8 ZIPCODE 98221 Latitude 48.50401 Longitude -122.65435 Name: 354, dtype: object CollectionDate 1534723200.0 Contaminant HAA9 AnalyticalResultValue 9.0 ZIPCODE 98221 Latitude 48.50401 Longitude -122.65435 Name: 355, dtype: object CollectionDate 1534723200.0 Contaminant manganese AnalyticalResultValue 9.8 ZIPCODE 98221 Latitude 48.50401 Longitude -122.65435 Name: 363, dtype: object CollectionDate 1541721600.0 Contaminant HAA9 AnalyticalResultValue 12.5 ZIPCODE 98221 Latitude 48.50401 Longitude -122.65435 Name: 320, dtype: object CollectionDate 1541721600.0 Contaminant HAA5 AnalyticalResultValue 12.5 ZIPCODE 98221 Latitude 48.50401 Longitude -122.65435 Name: 321, dtype: object CollectionDate 1541721600.0 Contaminant HAA6Br AnalyticalResultValue 0.0 ZIPCODE 98221 Latitude 48.50401 Longitude -122.65435 Name: 322, dtype: object CollectionDate 1541721600.0 Contaminant HAA9 AnalyticalResultValue 18.0 ZIPCODE 98221 Latitude 48.50401 Longitude -122.65435 Name: 332, dtype: object CollectionDate 1541721600.0 Contaminant HAA5 AnalyticalResultValue 17.7 ZIPCODE 98221 Latitude 48.50401 Longitude -122.65435 Name: 333, dtype: object CollectionDate 1541721600.0 Contaminant HAA6Br AnalyticalResultValue 0.3 ZIPCODE 98221 Latitude 48.50401 Longitude -122.65435 Name: 334, dtype: object CollectionDate 1541721600.0 Contaminant HAA5 AnalyticalResultValue 19.0 ZIPCODE 98221 Latitude 48.50401 Longitude -122.65435 Name: 344, dtype: object CollectionDate 1541721600.0 Contaminant HAA6Br AnalyticalResultValue 0.0 ZIPCODE 98221 Latitude 48.50401 Longitude -122.65435 Name: 345, dtype: object CollectionDate 1541721600.0 Contaminant HAA9 AnalyticalResultValue 19.0 ZIPCODE 98221 Latitude 48.50401 Longitude -122.65435 Name: 346, dtype: object CollectionDate 1541721600.0 Contaminant HAA5 AnalyticalResultValue 13.3 ZIPCODE 98221 Latitude 48.50401 Longitude -122.65435 Name: 356, dtype: object CollectionDate 1541721600.0 Contaminant HAA6Br AnalyticalResultValue 0.0 ZIPCODE 98221 Latitude 48.50401 Longitude -122.65435 Name: 357, dtype: object CollectionDate 1541721600.0 Contaminant HAA9 AnalyticalResultValue 13.3 ZIPCODE 98221 Latitude 48.50401 Longitude -122.65435 Name: 358, dtype: object CollectionDate 1541721600.0 Contaminant manganese AnalyticalResultValue 4.1 ZIPCODE 98221 Latitude 48.50401 Longitude -122.65435 Name: 364, dtype: object CollectionDate 1550102400.0 Contaminant HAA9 AnalyticalResultValue 11.3 ZIPCODE 98221 Latitude 48.50401 Longitude -122.65435 Name: 323, dtype: object CollectionDate 1550102400.0 Contaminant HAA5 AnalyticalResultValue 10.3 ZIPCODE 98221 Latitude 48.50401 Longitude -122.65435 Name: 324, dtype: object CollectionDate 1550102400.0 Contaminant HAA6Br AnalyticalResultValue 1.0 ZIPCODE 98221 Latitude 48.50401 Longitude -122.65435 Name: 325, dtype: object CollectionDate 1550102400.0 Contaminant HAA6Br AnalyticalResultValue 1.0 ZIPCODE 98221 Latitude 48.50401 Longitude -122.65435 Name: 335, dtype: object CollectionDate 1550102400.0 Contaminant HAA5 AnalyticalResultValue 12.0 ZIPCODE 98221 Latitude 48.50401 Longitude -122.65435 Name: 336, dtype: object CollectionDate 1550102400.0 Contaminant HAA9 AnalyticalResultValue 13.0 ZIPCODE 98221 Latitude 48.50401 Longitude -122.65435 Name: 337, dtype: object CollectionDate 1550102400.0 Contaminant HAA5 AnalyticalResultValue 13.7 ZIPCODE 98221 Latitude 48.50401 Longitude -122.65435 Name: 347, dtype: object CollectionDate 1550102400.0 Contaminant HAA6Br AnalyticalResultValue 1.2 ZIPCODE 98221 Latitude 48.50401 Longitude -122.65435 Name: 348, dtype: object CollectionDate 1550102400.0 Contaminant HAA9 AnalyticalResultValue 14.9 ZIPCODE 98221 Latitude 48.50401 Longitude -122.65435 Name: 349, dtype: object CollectionDate 1550102400.0 Contaminant HAA5 AnalyticalResultValue 10.9 ZIPCODE 98221 Latitude 48.50401 Longitude -122.65435 Name: 359, dtype: object CollectionDate 1550102400.0 Contaminant HAA6Br AnalyticalResultValue 1.0 ZIPCODE 98221 Latitude 48.50401 Longitude -122.65435 Name: 360, dtype: object CollectionDate 1550102400.0 Contaminant HAA9 AnalyticalResultValue 11.9 ZIPCODE 98221 Latitude 48.50401 Longitude -122.65435 Name: 361, dtype: object CollectionDate 1550102400.0 Contaminant manganese AnalyticalResultValue 3.0 ZIPCODE 98221 Latitude 48.50401 Longitude -122.65435 Name: 365, dtype: object
first_entry = list(zipcode_dict.items())[0]
print(first_entry)
import json
with open('zipcode_data.json', 'w') as f:
json.dump(zipcode_dict, f, indent=4)
(6339, {'chlorate': {160.0: [1426550400.0], 30.0: [1426550400.0], 340.0: [1434585600.0], 110.0: [1434585600.0], 470.0: [1444003200.0], 170.0: [1444003200.0], 370.0: [1450137600.0], 74.0: [1450137600.0]}, 'strontium': {72.0: [1426550400.0], 250.0: [1426550400.0], 66.0: [1434585600.0, 1450137600.0], 270.0: [1434585600.0, 1450137600.0], 62.0: [1444003200.0], 260.0: [1444003200.0]}, 'vanadium': {0.2: [1426550400.0, 1434585600.0, 1444003200.0, 1450137600.0]}, 'chromium': {0.2: [1426550400.0, 1450137600.0]}, 'cobalt': {1.4: [1426550400.0, 1450137600.0], 1.5: [1434585600.0], 1.3: [1444003200.0]}, 'chromium-6': {0.17: [1426550400.0, 1450137600.0], 0.14: [1434585600.0], 0.04: [1444003200.0], 0.06: [1444003200.0]}, 'manganese': {4.976: [1522627200.0], 18.045: [1528070400.0], 27.482: [1536019200.0], 8.949: [1543881600.0]}, 'HAA6Br': {11.408: [1522627200.0], 10.822: [1522627200.0], 10.543: [1528070400.0], 11.057: [1528070400.0], 8.943: [1536019200.0], 9.137: [1536019200.0], 11.502: [1543881600.0], 11.277: [1543881600.0]}, 'HAA9': {40.535: [1522627200.0], 36.732: [1522627200.0], 52.079: [1528070400.0], 52.347: [1528070400.0], 23.006: [1536019200.0], 27.152: [1536019200.0], 29.425: [1543881600.0], 32.134: [1543881600.0]}, 'HAA5': {29.643: [1522627200.0], 26.422: [1522627200.0], 42.602: [1528070400.0], 42.34: [1528070400.0], 15.501: [1536019200.0], 19.231: [1536019200.0], 19.545: [1543881600.0], 22.223: [1543881600.0]}})
import os
import heapq
import datetime
import matplotlib.pyplot as plt
from sklearn.ensemble import RandomForestRegressor # Import RandomForestRegressor
from sklearn.metrics import mean_squared_error, r2_score
from sklearn.model_selection import train_test_split
def train_model_per_zipcode(zipcode_dict):
"""Trains a Random Forest Regression model for each zip code and contaminant.
Stores predicted AnalyticalResultValues for future date and returns a list of tuples
containing (zipcode, contaminant, predicted_AnalyticalResultValue).
Args:
zipcode_dict: A dictionary with zip codes as keys and inner dictionaries
containing contaminant data (collection date and AnalyticalResultValue).
"""
models = {}
top_graphs = [] # Priority queue to store top graphs (abs(r2_score - 1), file_name)
graph_count = 0
predicted_AnalyticalValues = [] # List to store (zipcode, contaminant, predicted_AnalyticalResultValue)
# Create an 'output_graphs' directory if it doesn't exist
output_dir = 'output_graphs'
if not os.path.exists(output_dir):
os.makedirs(output_dir)
for zipcode, contaminant_data in zipcode_dict.items():
for contaminant, data_points in contaminant_data.items(): # Iterate through contaminants
X = []
y = []
# Changed loop to iterate through the actual structure of data_points
for analyticalResultValue, collection_dates in data_points.items():
for collection_date in collection_dates:
X.append([collection_date]) # Use collection date as the feature
y.append(analyticalResultValue) # Use analyticalResultValue as the target
if len(X) > 1: # Need at least 2 data points for training
X_train, X_test, y_train, y_test = train_test_split(
X, y, test_size=0.2, random_state=42
)
# Create and train a RandomForestRegressor model
model = RandomForestRegressor(n_estimators=100, random_state=42)
model.fit(X_train, y_train)
y_pred = model.predict(X_test)
# Calculate and print the MSE for this model
mse = mean_squared_error(y_test, y_pred)
print(f"\nZip Code: {zipcode}, MSE: {mse}")
# Calculate and print the R-squared score
r2 = r2_score(y_test, y_pred)
if np.isnan(r2):
r2 = 1.0
print(f"Zip Code: {zipcode}, R^2 score: {r2}")
models[zipcode] = model # Store the model for this zip code
# --- Prediction into the future ---
future_date = datetime.datetime.now() + datetime.timedelta(days=365)
future_date_timestamp = int(future_date.timestamp())
future_prediction = model.predict([[future_date_timestamp]])
print(f"Prediction for {contaminant} in zip code {zipcode} on {future_date.strftime('%Y-%m-%d')}: {future_prediction[0]}")
# Store the prediction
predicted_AnalyticalValues.append((zipcode, contaminant, future_prediction[0], future_date.strftime('%Y-%m-%d')))
# --- Plotting ---
X_dates = [datetime.datetime.fromtimestamp(ts) for ts in np.array(X).flatten()]
plt.figure(figsize=(8, 6))
plt.scatter(X_dates, y, color='blue', label='Actual AnalyticalResultValue')
plt.plot(X_dates, model.predict(np.array(X).reshape(-1, 1)), color='red', label='Predicted AnalyticalResultValue')
# Add future prediction to the plot
plt.scatter([future_date], future_prediction, color='green', marker='o', s=100, label='Future Prediction')
plt.title(f"Random Forest Regression for Zip Code: {zipcode} and Contaminant: {contaminant}\n"
f"Prediction for {future_date.strftime('%Y-%m-%d')}: {future_prediction[0]}\n"
f"Mean Squared Error: {mse}, R^2 Score: {r2}")
plt.xlabel('Collection Date')
plt.ylabel('AnalyticalResultValue')
plt.xticks(rotation=45, ha='right')
plt.legend()
plt.grid(True)
plt.tight_layout()
# --- Saving Graphs (with variety selection) ---
file_name = os.path.join(output_dir, f"{zipcode}_{contaminant}_graph.png")
# plt.savefig(file_name) # Save the graph - might not be necessary unless you want a lot
# Calculate and print the R-squared score
r2 = r2_score(y_test, y_pred)
if np.isnan(r2):
r2 = 1.0 # Handle NaN by setting R^2 to 1.0
#print(f"Zip Code: {zipcode}, R^2 score: {r2}")
accuracy = abs(r2 - 1)
models[zipcode] = model # Store the model for this zip code
# Calculate variety (standard deviation of MRL values)
variety = np.std(y)
# Add to priority queue based on variety and accuracy
score = variety * (1 - accuracy) # Combine variety and accuracy
heapq.heappush(top_graphs, (-score, file_name)) # Use negative for max-heap
if len(top_graphs) > 5: # Keep only top 5
heapq.heappop(top_graphs)
graph_count += 1
plt.show()
# Save the top 15 most accurate graphs
print(f"Saving top 15 most accurate predictions based on R^2 score out of {graph_count} total graphs")
for accuracy, file_name in top_graphs:
plt.savefig(file_name)
print(f"Total graphs generated: {graph_count}")
return models, predicted_AnalyticalValues
# Train models for each zip code
models, predicted_AnalyticalValues = train_model_per_zipcode(zipcode_dict)
# You can now use these models to make predictions for future collection dates
# for each zip code.
print(models)
Zip Code: 6339, MSE: 32670.10442244444 Zip Code: 6339, R^2 score: -5.667368249478457 Prediction for chlorate in zip code 6339 on 2025-11-12: 239.09
Zip Code: 6339, MSE: 26665.292192499997 Zip Code: 6339, R^2 score: -265.652921925 Prediction for strontium in zip code 6339 on 2025-11-12: 92.69200000000001
Zip Code: 6339, MSE: 1.3019286424057714e-31 Zip Code: 6339, R^2 score: 1.0 Prediction for vanadium in zip code 6339 on 2025-11-12: 0.19999999999999965
/usr/local/lib/python3.10/dist-packages/sklearn/metrics/_regression.py:1211: UndefinedMetricWarning: R^2 score is not well-defined with less than two samples. warnings.warn(msg, UndefinedMetricWarning) /usr/local/lib/python3.10/dist-packages/sklearn/metrics/_regression.py:1211: UndefinedMetricWarning: R^2 score is not well-defined with less than two samples. warnings.warn(msg, UndefinedMetricWarning)
Zip Code: 6339, MSE: 1.509929076399593e-31 Zip Code: 6339, R^2 score: 1.0 Prediction for chromium in zip code 6339 on 2025-11-12: 0.19999999999999962
/usr/local/lib/python3.10/dist-packages/sklearn/metrics/_regression.py:1211: UndefinedMetricWarning: R^2 score is not well-defined with less than two samples. warnings.warn(msg, UndefinedMetricWarning) /usr/local/lib/python3.10/dist-packages/sklearn/metrics/_regression.py:1211: UndefinedMetricWarning: R^2 score is not well-defined with less than two samples. warnings.warn(msg, UndefinedMetricWarning)
Zip Code: 6339, MSE: 0.0025000000000001154 Zip Code: 6339, R^2 score: 1.0 Prediction for cobalt in zip code 6339 on 2025-11-12: 1.3499999999999988
/usr/local/lib/python3.10/dist-packages/sklearn/metrics/_regression.py:1211: UndefinedMetricWarning: R^2 score is not well-defined with less than two samples. warnings.warn(msg, UndefinedMetricWarning) /usr/local/lib/python3.10/dist-packages/sklearn/metrics/_regression.py:1211: UndefinedMetricWarning: R^2 score is not well-defined with less than two samples. warnings.warn(msg, UndefinedMetricWarning)
Zip Code: 6339, MSE: 0.013171387777777785 Zip Code: 6339, R^2 score: 1.0 Prediction for chromium-6 in zip code 6339 on 2025-11-12: 0.055233333333333315
/usr/local/lib/python3.10/dist-packages/sklearn/metrics/_regression.py:1211: UndefinedMetricWarning: R^2 score is not well-defined with less than two samples. warnings.warn(msg, UndefinedMetricWarning) /usr/local/lib/python3.10/dist-packages/sklearn/metrics/_regression.py:1211: UndefinedMetricWarning: R^2 score is not well-defined with less than two samples. warnings.warn(msg, UndefinedMetricWarning)
Zip Code: 6339, MSE: 43.14742556889999 Zip Code: 6339, R^2 score: 1.0 Prediction for manganese in zip code 6339 on 2025-11-12: 12.787879999999998
/usr/local/lib/python3.10/dist-packages/sklearn/metrics/_regression.py:1211: UndefinedMetricWarning: R^2 score is not well-defined with less than two samples. warnings.warn(msg, UndefinedMetricWarning) /usr/local/lib/python3.10/dist-packages/sklearn/metrics/_regression.py:1211: UndefinedMetricWarning: R^2 score is not well-defined with less than two samples. warnings.warn(msg, UndefinedMetricWarning)
Zip Code: 6339, MSE: 0.35435278561671835 Zip Code: 6339, R^2 score: 0.5007753374717131 Prediction for HAA6Br in zip code 6339 on 2025-11-12: 11.202760000000001
Zip Code: 6339, MSE: 24.179281688917285 Zip Code: 6339, R^2 score: -0.053834392672508224 Prediction for HAA9 in zip code 6339 on 2025-11-12: 30.67623000000002
Zip Code: 6339, MSE: 23.250461824147912 Zip Code: 6339, R^2 score: -0.798510582343871 Prediction for HAA5 in zip code 6339 on 2025-11-12: 20.953629999999997
Zip Code: 35005, MSE: 2.249639711999923e-05 Zip Code: 35005, R^2 score: 0.8513028149910817 Prediction for chromium-6 in zip code 35005 on 2025-11-12: 0.060850000000000036
Zip Code: 35005, MSE: 0.002683550809000013 Zip Code: 35005, R^2 score: 1.0 Prediction for 1,4-dioxane in zip code 35005 on 2025-11-12: 0.16129899999999964
/usr/local/lib/python3.10/dist-packages/sklearn/metrics/_regression.py:1211: UndefinedMetricWarning: R^2 score is not well-defined with less than two samples. warnings.warn(msg, UndefinedMetricWarning) /usr/local/lib/python3.10/dist-packages/sklearn/metrics/_regression.py:1211: UndefinedMetricWarning: R^2 score is not well-defined with less than two samples. warnings.warn(msg, UndefinedMetricWarning)
Zip Code: 35005, MSE: 2.737578952668344 Zip Code: 35005, R^2 score: 0.8967827711313661 Prediction for strontium in zip code 35005 on 2025-11-12: 47.64845999999999
Zip Code: 35005, MSE: 81.54252540810002 Zip Code: 35005, R^2 score: 1.0 Prediction for chlorate in zip code 35005 on 2025-11-12: 66.56536166666666
/usr/local/lib/python3.10/dist-packages/sklearn/metrics/_regression.py:1211: UndefinedMetricWarning: R^2 score is not well-defined with less than two samples. warnings.warn(msg, UndefinedMetricWarning) /usr/local/lib/python3.10/dist-packages/sklearn/metrics/_regression.py:1211: UndefinedMetricWarning: R^2 score is not well-defined with less than two samples. warnings.warn(msg, UndefinedMetricWarning)
Zip Code: 35005, MSE: 0.004899999999999294 Zip Code: 35005, R^2 score: 1.0 Prediction for molybdenum in zip code 35005 on 2025-11-12: 2.699999999999995
/usr/local/lib/python3.10/dist-packages/sklearn/metrics/_regression.py:1211: UndefinedMetricWarning: R^2 score is not well-defined with less than two samples. warnings.warn(msg, UndefinedMetricWarning) /usr/local/lib/python3.10/dist-packages/sklearn/metrics/_regression.py:1211: UndefinedMetricWarning: R^2 score is not well-defined with less than two samples. warnings.warn(msg, UndefinedMetricWarning)
Zip Code: 35005, MSE: 0.03678222440000002 Zip Code: 35005, R^2 score: -573.7222562499993 Prediction for vanadium in zip code 35005 on 2025-11-12: 0.23599000000000003
Zip Code: 35005, MSE: 4.65672325577975 Zip Code: 35005, R^2 score: -1.062301783370784 Prediction for manganese in zip code 35005 on 2025-11-12: 0.9145784999999997
Zip Code: 35005, MSE: 43.09299645627168 Zip Code: 35005, R^2 score: 0.354307515125848 Prediction for HAA5 in zip code 35005 on 2025-11-12: 20.16954955555555
Zip Code: 35005, MSE: 62.07353826315188 Zip Code: 35005, R^2 score: 0.29042820273434755 Prediction for HAA9 in zip code 35005 on 2025-11-12: 25.005654833333328
Zip Code: 35005, MSE: 3.536149026344943 Zip Code: 35005, R^2 score: -0.49063823009554075 Prediction for HAA6Br in zip code 35005 on 2025-11-12: 5.093068722222218
Zip Code: 48858, MSE: 0.08880696931972776 Zip Code: 48858, R^2 score: 0.49413751653319626 Prediction for molybdenum in zip code 48858 on 2025-11-12: 2.1629999999999963
Zip Code: 48858, MSE: 6686.347541122447 Zip Code: 48858, R^2 score: 0.660935723066813 Prediction for strontium in zip code 48858 on 2025-11-12: 266.1666666666667
Zip Code: 48858, MSE: 31012.51951721527 Zip Code: 48858, R^2 score: 0.5476269462873941 Prediction for chlorate in zip code 48858 on 2025-11-12: 251.67166666666665
Zip Code: 48858, MSE: 0.03675337111111109 Zip Code: 48858, R^2 score: -15.539016999999998 Prediction for chromium in zip code 48858 on 2025-11-12: 0.7316333333333332
Zip Code: 48858, MSE: 0.005811347366666692 Zip Code: 48858, R^2 score: -7.435826822580687 Prediction for chromium-6 in zip code 48858 on 2025-11-12: 0.4129733333333336
Zip Code: 48858, MSE: 0.008836000000000078 Zip Code: 48858, R^2 score: 0.0 Prediction for vanadium in zip code 48858 on 2025-11-12: 0.2069999999999996
Zip Code: 48858, MSE: 195.62658958375644 Zip Code: 48858, R^2 score: -0.9685773242877842 Prediction for HAA9 in zip code 48858 on 2025-11-12: 11.389845833333332
Zip Code: 48858, MSE: 53.623383426883 Zip Code: 48858, R^2 score: -0.7128841118272176 Prediction for HAA6Br in zip code 48858 on 2025-11-12: 8.11052916666666
Zip Code: 48858, MSE: 62.41210389526889 Zip Code: 48858, R^2 score: -1.1075972504260823 Prediction for HAA5 in zip code 48858 on 2025-11-12: 4.969304166666672
Zip Code: 48858, MSE: 722.3040272499999 Zip Code: 48858, R^2 score: -6067.506845200586 Prediction for manganese in zip code 48858 on 2025-11-12: 64.7918333333333
Zip Code: 48858, MSE: 449.44000000000074 Zip Code: 48858, R^2 score: 1.0 Prediction for 2-methoxyethanol in zip code 48858 on 2025-11-12: 26.30000000000002
/usr/local/lib/python3.10/dist-packages/sklearn/metrics/_regression.py:1211: UndefinedMetricWarning: R^2 score is not well-defined with less than two samples. warnings.warn(msg, UndefinedMetricWarning) /usr/local/lib/python3.10/dist-packages/sklearn/metrics/_regression.py:1211: UndefinedMetricWarning: R^2 score is not well-defined with less than two samples. warnings.warn(msg, UndefinedMetricWarning)
Zip Code: 48858, MSE: 2.2499999999999844e-06 Zip Code: 48858, R^2 score: 1.0 Prediction for PFBS in zip code 48858 on 2025-11-12: 0.0033000000000000048
/usr/local/lib/python3.10/dist-packages/sklearn/metrics/_regression.py:1211: UndefinedMetricWarning: R^2 score is not well-defined with less than two samples. warnings.warn(msg, UndefinedMetricWarning) /usr/local/lib/python3.10/dist-packages/sklearn/metrics/_regression.py:1211: UndefinedMetricWarning: R^2 score is not well-defined with less than two samples. warnings.warn(msg, UndefinedMetricWarning)
Zip Code: 56633, MSE: 0.32031826777777733 Zip Code: 56633, R^2 score: 1.0 Prediction for HAA9 in zip code 56633 on 2025-11-12: 0.2709333333333333
/usr/local/lib/python3.10/dist-packages/sklearn/metrics/_regression.py:1211: UndefinedMetricWarning: R^2 score is not well-defined with less than two samples. warnings.warn(msg, UndefinedMetricWarning) /usr/local/lib/python3.10/dist-packages/sklearn/metrics/_regression.py:1211: UndefinedMetricWarning: R^2 score is not well-defined with less than two samples. warnings.warn(msg, UndefinedMetricWarning)
Zip Code: 56633, MSE: 0.006084000000000002 Zip Code: 56633, R^2 score: 1.0 Prediction for HAA6Br in zip code 56633 on 2025-11-12: 0.07800000000000001
/usr/local/lib/python3.10/dist-packages/sklearn/metrics/_regression.py:1211: UndefinedMetricWarning: R^2 score is not well-defined with less than two samples. warnings.warn(msg, UndefinedMetricWarning) /usr/local/lib/python3.10/dist-packages/sklearn/metrics/_regression.py:1211: UndefinedMetricWarning: R^2 score is not well-defined with less than two samples. warnings.warn(msg, UndefinedMetricWarning)
Zip Code: 56633, MSE: 0.013448267777777686 Zip Code: 56633, R^2 score: 1.0 Prediction for HAA5 in zip code 56633 on 2025-11-12: 0.2709333333333333
/usr/local/lib/python3.10/dist-packages/sklearn/metrics/_regression.py:1211: UndefinedMetricWarning: R^2 score is not well-defined with less than two samples. warnings.warn(msg, UndefinedMetricWarning) /usr/local/lib/python3.10/dist-packages/sklearn/metrics/_regression.py:1211: UndefinedMetricWarning: R^2 score is not well-defined with less than two samples. warnings.warn(msg, UndefinedMetricWarning)
Zip Code: 98221, MSE: 5.93629434446996 Zip Code: 98221, R^2 score: -0.38455844768978675 Prediction for HAA9 in zip code 98221 on 2025-11-12: 12.290666666666676
Zip Code: 98221, MSE: 5.805016434597076 Zip Code: 98221, R^2 score: -0.7779529661859348 Prediction for HAA5 in zip code 98221 on 2025-11-12: 11.13539444444445
Zip Code: 98221, MSE: 0.0012962816512345587 Zip Code: 98221, R^2 score: 0.9711937410836765 Prediction for HAA6Br in zip code 98221 on 2025-11-12: 1.0294777777777775
Zip Code: 98221, MSE: 39.03750399999998 Zip Code: 98221, R^2 score: 1.0 Prediction for manganese in zip code 98221 on 2025-11-12: 3.2060000000000004
/usr/local/lib/python3.10/dist-packages/sklearn/metrics/_regression.py:1211: UndefinedMetricWarning: R^2 score is not well-defined with less than two samples. warnings.warn(msg, UndefinedMetricWarning) /usr/local/lib/python3.10/dist-packages/sklearn/metrics/_regression.py:1211: UndefinedMetricWarning: R^2 score is not well-defined with less than two samples. warnings.warn(msg, UndefinedMetricWarning)
Saving top 15 most accurate predictions based on R^2 score out of 39 total graphs
Total graphs generated: 39
{6339: RandomForestRegressor(random_state=42), 35005: RandomForestRegressor(random_state=42), 48858: RandomForestRegressor(random_state=42), 56633: RandomForestRegressor(random_state=42), 98221: RandomForestRegressor(random_state=42)}
<Figure size 640x480 with 0 Axes>
# print the top 10 zip codes and contaminants that have the highest predicted AnalyticalResultValue
def print_top_10_zipcodes_predicted_contaminants(predicted_AnalyticalResultValue):
"""Prints the top 10 zip codes with the highest predicted contaminants based on predicted AnalyticalResultValue.
Args:
predicted_AnalyticalValues (list): A list of tuples containing (zipcode, contaminant, predicted_AnalyticalResultValue).
"""
# Create a dictionary to store zip codes and their highest predicted MRLs
zipcode_max_AnalyticalResultValue = {}
for zipcode, contaminant, predicted_AnalyticalResultValue, collectionDate in predicted_AnalyticalResultValue:
if zipcode not in zipcode_max_AnalyticalResultValue or predicted_AnalyticalResultValue > zipcode_max_AnalyticalResultValue[zipcode][0]:
zipcode_max_AnalyticalResultValue[zipcode] = (predicted_AnalyticalResultValue, contaminant, collectionDate)
# Sort zip codes by highest predicted AnalyticalResultValue in descending order
sorted_zipcodes = sorted(zipcode_max_AnalyticalResultValue.items(), key=lambda item: item[1][0], reverse=True)
print("\nTop 10 Zip Codes with Highest Predicted Contaminants and AnalyticalResultValue:")
for i, (zipcode, (predicted_AnalyticalResultValue, contaminant, collectionDate)) in enumerate(sorted_zipcodes[:10]):
print(f"{i+1}. Zip Code: {zipcode}, Contaminant: {contaminant}, Predicted AnalyticalResultValue: {predicted_AnalyticalResultValue}, Date: {collectionDate}")
# Assuming 'df' is your DataFrame
print_top_10_zipcodes_predicted_contaminants(predicted_AnalyticalValues)
Top 10 Zip Codes with Highest Predicted Contaminants and AnalyticalResultValue: 1. Zip Code: 48858, Contaminant: strontium, Predicted AnalyticalResultValue: 266.1666666666667, Date: 2025-11-12 2. Zip Code: 6339, Contaminant: chlorate, Predicted AnalyticalResultValue: 239.09, Date: 2025-11-12 3. Zip Code: 35005, Contaminant: chlorate, Predicted AnalyticalResultValue: 66.56536166666666, Date: 2025-11-12 4. Zip Code: 98221, Contaminant: HAA9, Predicted AnalyticalResultValue: 12.290666666666676, Date: 2025-11-12 5. Zip Code: 56633, Contaminant: HAA9, Predicted AnalyticalResultValue: 0.2709333333333333, Date: 2025-11-12
import matplotlib.pyplot as plt
def plot_top_zipcodes_predicted_contaminants(predicted_AnalyticalResultValue, zipcode_data):
# Sort predicted AnalyticalResultValue in descending order
sorted_predictions = sorted(predicted_AnalyticalResultValue, key=lambda item: item[2], reverse=True)
# Prepare data for the vertical bar graph (using sorted_predictions directly)
top_zipcodes_contaminants = [(f"{zipcode} - {contaminant} ({predicted_date})")
for zipcode, contaminant, analyticalResultValue, predicted_date in sorted_predictions[:10]]
top_analyticalResultValues = [analyticalResultValue for zipcode, contaminant, analyticalResultValue, predicted_date in sorted_predictions[:10]]
# Get zip codes from sorted_predictions (avoiding zipcode_max_analyticalResultValue)
zipcodes_list = [str(zipcode) for zipcode, _, _, _ in sorted_predictions[:10]]
# Get unique zip codes from zipcode_data
unique_zipcodes = [str(zipcode) for zipcode, _ in zipcode_data]
# Create the vertical bar graph
plt.figure(figsize=(10, 6))
plt.bar(top_zipcodes_contaminants, top_analyticalResultValues)
plt.xlabel("Zip Code - Contaminant - Predicted Date")
plt.ylabel("Predicted AnalyticalResultValue")
plt.title(f"Random Forest Regression:\nTop 10 Highest Predicted AnalyticalResultValue in Zip Codes: {', '.join(unique_zipcodes)}\n")
plt.xticks(rotation=45, ha='right')
plt.tight_layout()
plt.show()
# Assuming 'predicted_AnalyticalValues' is your list of tuples and 'zipcode_data' is available
plot_top_zipcodes_predicted_contaminants(predicted_AnalyticalValues, zipcode_data) # Pass zipcode_data
# prompt: print the number of zipcodes our data has, no duplicates
unique_zipcodes = df['ZIPCODE'].unique()
print(f"Number of unique zipcodes: {len(unique_zipcodes)}")
Number of unique zipcodes: 6
Prediction level heatmaps based on training data
print(f"Heatmap of all predictions")
heatmap_prediction_data = pd.DataFrame(predicted_AnalyticalValues, columns=['ZIPCODE', 'Contaminant', 'PredictedValue', 'Date'])
# Merge with original DataFrame to get Latitude and Longitude
heatmap_prediction_data = pd.merge(heatmap_prediction_data, df[['ZIPCODE', 'Latitude', 'Longitude']], on='ZIPCODE', how='left')
# Select the necessary columns for the heatmap
heatmap_data = heatmap_prediction_data[['Latitude', 'Longitude', 'PredictedValue']].values.tolist()
# Create a folium map centered on the US
m = folium.Map(location=[37.8, -96.9], zoom_start=4)
# Add a heatmap layer using Latitude, Longitude, and PredictedValue
HeatMap(heatmap_data, min_opacity=0.2, radius=10, blur=10, max_zoom=1).add_to(m)
display(m)
print("\n")
# Create file name and save the map
# file_name = os.path.join(output_dir, f"prediction_heatmap.html")
# save_heatmap_to_file(m, file_name)
Heatmap of all predictions
Prediction heatmaps for individual contaminants
for contaminant, group_data in sorted(heatmap_prediction_data.groupby('Contaminant')):
print(f"Generating prediction heatmap for Contaminant: {contaminant}\n")
# Prepare data for this heatmap
heatmap_data = group_data[['Latitude', 'Longitude', 'PredictedValue']].values.tolist()
# Create a folium map centered on the US
m = folium.Map(location=[37.8, -96.9], zoom_start=4)
# Add a heatmap layer using Latitude, Longitude, and PredictedValue
HeatMap(heatmap_data, min_opacity=0.2, radius=10, blur=10, max_zoom=1).add_to(m)
display(m)
print("\n")
# Create file name and save the map
# file_name = os.path.join(output_dir, f"{contaminant}_prediction_heatmap.html")
# save_heatmap_to_file(m, file_name)
#print(f"Prediction heatmaps saved to the '{output_dir}' directory.")
Generating prediction heatmap for Contaminant: 1,4-dioxane
Generating prediction heatmap for Contaminant: 2-methoxyethanol
Generating prediction heatmap for Contaminant: HAA5
Generating prediction heatmap for Contaminant: HAA6Br
Generating prediction heatmap for Contaminant: HAA9
Generating prediction heatmap for Contaminant: PFBS
Generating prediction heatmap for Contaminant: chlorate
Generating prediction heatmap for Contaminant: chromium
Generating prediction heatmap for Contaminant: chromium-6
Generating prediction heatmap for Contaminant: cobalt
Generating prediction heatmap for Contaminant: manganese
Generating prediction heatmap for Contaminant: molybdenum
Generating prediction heatmap for Contaminant: strontium
Generating prediction heatmap for Contaminant: vanadium